sampEstimate: Estimate the sample size required to achieve a specified...

Description Usage Arguments Details

View source: R/sampEstimate.R

Description

Calculate the number of samples needed to estimate the population prevalence with a specified precision. Precision is defined in terms of the quantiles of the distribution of estimated prevalence values. For example, we might say, "If the true prevalence is 1 greater than 0.5 we don't grossly underestimate the prevalence.

Usage

1
sampEstimate(Npop, popprev, prob, targ, sensitivity, specificity)

Arguments

Npop

Population size

popprev

True population prevalence

prob

The quantile to place a restriction on (e.g., 0.05 for the 5th percentile)

targ

Target value for prob

sensitivity

Sensitivity of the test

specificity

Specificity of the test

Details

The characteristics of the system that are specified are:

The solver actually solves for the sample size that is as close as possible to being equal to the required condition, so it is indifferent to whether we are setting an upper bound or a lower bound on the quantile. So, in place of the example above we could just as well say that we want the 95th percentile of estimated values to be less than 2

Solution is carried out using a bounded secant solver. No initial guess is required because we can start with the basic assumption that the number of samples must be greater than zero and less than the total population. Since the number of samples must be a whole number, we shrink the interval until it's less than a quarter-person wide, and then we return the ceiling of the upper bound.


rplzzz/sampEstimator documentation built on May 24, 2020, 4:35 a.m.