Learn R Programming

EpiBayes (version 0.1.2)

EpiBayesSampleSize: Sample Size Search for EpiBayes Models

Description

This function takes three vectors for the number of subzones, clusters per subzone, and subjects per cluster per subzone and uses all combinations of the given values as inputs to EpiBayes_ns as a way to search for sample sizes which give optimal values of the Bayesian model output (e.g., p4.tilde). It assumes that at every sampling level, all elements have the same size (e.g., if the user supplies H = 2, k = 10, n = 100, then we assume that there are two subzones, both of which contain 10 clusters/farms/ponds/herds, and all clusters in all subzones contain 100 subjects/individuals/mollusks/cows/chickens). This is done for computational efficiency in the search.

Usage

EpiBayesSampleSize(H.vect, k.vect, n.vect, season.vect, ...)

Arguments

H.vect
Values of possible numbers of subzones. Integer vector.
k.vect
Values of possible numbers of clusters within subzones. Integer vector.
n.vect
Values of possible numbers of subjects within clusters within subzones. Integer vector.
season.vect
The single season in which one assumes sampling is taking place. Coded as (1) Summer, (2) Fall, (3) Winter, (4) Spring. Integer scalar.
...
Additional arguments that will be passed to EpiBayes_ns. Otherwise, the default values will be used.

Value

The returned values are given in a matrix. They are as follows.
Output Attributes
Description RawPost
List: Length - (number of periods), Elements - Real arrays (reps x H x MCMCreps) Posterior distributions for the cluster-level prevalences for each subzone from all time periods
BetaBusterEst List: Length - (number of periods), Elements - Real vectors (2 x 1)
Estimated posterior distributions for the cluster-level prevalences for each subzone from all time periods using moment-matching to the closest beta distribution by the function epi.betabuster ForOthers
Various other data not intended to be used by the user, but used to pass information on to the plot, summary, and print methods

Examples

Run this code
testrun_samplesize = EpiBayesSampleSize(
		H = c(2, 4),
		k = c(10, 20),
		n = c(100, 500),
		season = 3,
		burnin = 1,
		reps = 1,
		MCMCreps = 10,
		tau.T = 0,
		poi = "tau",
		mumodes = matrix(c(
			0.50, 0.70,
			0.50, 0.70,
			0.02, 0.50,
			0.02, 0.50
			), 4, 2, byrow = TRUE
		),
		pi.thresh = 0.05,
	    tau.thresh = 0.02,
     gam.thresh = 0.10,
		poi.lb = 0.1,
		poi.ub = 0.4,
		p1 = 0.95,
		psi = 4,
		tauparm = c(1, 1),
		omegaparm = c(1000, 1),
		gamparm = c(1000, 1),
		etaparm = c(100, 6),
		thetaparm = c(100, 6)
		)

testrun_samplesize
print(testrun_samplesize, out.ptilde = "p4.tilde")

Run the code above in your browser using DataLab