computeOptimalSampleSizeRiskGroups: FUNCTION to compute the optimal sample size for populations...

FUNCTION to compute the optimal sample size for populations stratified by
risk factors.

Share:

Description

Computes the optimal sample size (for each risk group) for a survey to
substantiate freedom from disease for a population stratified into risk groups.
The optimal sample size is the smallest sample size that produces
an alpha-error less than or equal to a prediscribed value for alpha.
The population is considered as diseased if at least one individual has a
positive test result. The sample size is computed using a bisection method.
The sample size can be fixed for a subset of the risk groups via the input
parameter 'nSampleFixVec' (vector containing sample sizes for the risk groups
with fixed values and NA for the risk groups for which the sample size is to
be computed). For those risk groups for which the sample size is to be
computed a vector specifying the proportional distribution among the risk
groups ('nSamplePropVec') needs to be specified.

Example: We have 3 risk groups. For the 2nd risk group we want 20 farms
to be sampled. For the other risk groups we specify that the sample size
for risk group 1 should be double the sample size of risk group 3. We
then set:
nSampleFixVec <- c(NA, 20, NA)
nSamplePropVec <- c(2,1)

Usage

Arguments

nPopulationVec

Integer vector. Population sizes of the risk groups.

nRelRiskVec

Numeric vector. (Relative) infection risks of the
risk groups.

nSampleFixVec

Numeric vector containing NAs (optional argument).
For risk groups for which the sample size is fixed
specify the sample size. For the risk groups for which
the sample size should be computed set NA (order of the
risk groups must be the same order as in nPopulationVec
and nRelRiskVec) .

nSamplePropVec

Numeric vector. For those risk groups for which the
sample size should be computed a proportional
distribution of the overall sample size must be specified.
The vector must have the same length as the number of
NA entries in nSampleFixVec or if nSampleFixVec is not
specified, nSamplePropVec must have the same length as
nPopulationVec.

prevalence

Numeric between 0 and 1. Design prvalence. The number of diseased
is then computed as max(1,nPopulation*prevalence).

alpha

Numeric between 0 and 1. Alpha-Error (=error of the first kind,
significance level) of the underlying significance test. Default
value = 0.05.