Learn R Programming

epiR (version 0.9-27)

epi.simplesize: Sample size under under simple random sampling

Description

Estimates the required sample size under under simple random sampling.

Usage

epi.simplesize(N = 1E+06, sd, Py, epsilon.a, method = "mean", 
   conf.level = 0.95)

Arguments

N
scalar, representing the population size.
sd
scalar, if method is total or mean this is the estimated standard deviation of the sampling variable.
Py
scalar, if method is proportion this is an estimate of the unknown population proportion.
epsilon.a
the maximum absolute difference between our estimate and the unknown population value.
method
a character string indicating the method to be used. Options are total, mean, or proportion.
conf.level
scalar, defining the level of confidence in the computed result.

Value

  • Returns an integer defining the size of the sample is required.

References

Levy PS, Lemeshow S (1999). Sampling of Populations Methods and Applications. Wiley Series in Probability and Statistics, London, pp. 70 - 75. Scheaffer RL, Mendenhall W, Lyman Ott R (1996). Elementary Survey Sampling. Duxbury Press, New York, pp. 95.

Examples

Run this code
## EXAMPLE 1
## We want to estimate the mean bodyweight of deer on a farm. There are 278
## animals present. We anticipate the standard deviation of body weight to be 
## around 30 kg. We would like to be 95\% certain that our estimate is within 
## 10 kg of the true mean. How many deer should be sampled?

epi.simplesize(N = 278, sd = 30, Py = NA, epsilon.a = 10, method = "mean", 
   conf.level = 0.95)

## A total of 31 deer need to be sampled to meet the survey requirements.

## EXAMPLE 2
## We want to estimate the seroprevalence of Brucella abortus in a population 
## of cattle. An estimate of the unknown prevalence of B. abortus in this 
## population is 0.15. We would like to be 95\% certain that our estimate is 
## within 20\% of the true proportion of the population that is seropositive 
## to B. abortus. Calculate the required sample size.

## Convert relative error into absolute error:
epsilon.r <- 0.20; Py = 0.15
epsilon.a <- epsilon.r * Py

epi.simplesize(N = 1E+06, sd = NA, Py = Py, epsilon.a = epsilon.a, 
   method = "proportion", conf.level = 0.95)

## A total of 544 cattle need to be sampled to meet the survey requirements.

Run the code above in your browser using DataLab