ss4p {samplesize4surveys} | R Documentation |
The required sample size for estimating a single proportion
Description
This function returns the minimum sample size required for estimating a single proportion subjecto to predefined errors.
Usage
ss4p(N, P, DEFF = 1, conf = 0.95, error = "cve", delta = 0.03, plot = FALSE)
Arguments
N |
The population size. |
P |
The value of the estimated proportion. |
DEFF |
The design effect of the sample design. By default |
conf |
The statistical confidence. By default conf = 0.95. By default |
error |
The type of error you want to minimize. |
delta |
The magnitude of the error you want to minimize. |
plot |
Optionally plot the errors (cve and margin of error) against the sample size. |
Details
Note that the minimun sample size to achieve a particular margin of error \varepsilon
is defined by:
n = \frac{n_0}{1+\frac{n_0}{N}}
Where
n_0=\frac{z^2_{1-\frac{\alpha}{2}}S^2}{\varepsilon^2}
and
S^2=P(1-P)DEFF
Also note that the minimun sample size to achieve a particular coefficient of variation cve
is defined by:
n = \frac{S^2}{P^2cve^2+\frac{S^2}{N}}
Author(s)
Hugo Andres Gutierrez Rojas <hagutierrezro at gmail.com>
References
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas
See Also
Examples
ss4p(N=10000, P=0.05, error = "cve", delta=0.05, DEFF = 1, conf = 0.95, plot=TRUE)
ss4p(N=10000, P=0.05, error = "me", delta=0.05, DEFF = 1, conf = 0.95, plot=TRUE)
ss4p(N=10000, P=0.5, error = "rme", delta=0.05, DEFF = 1, conf = 0.95, plot=TRUE)
##########################
# Example with Lucy data #
##########################
data(Lucy)
attach(Lucy)
N <- nrow(Lucy)
P <- prop.table(table(SPAM))[1]
# The minimum sample size for simple random sampling
ss4p(N, P, DEFF=3.45, conf=0.95, error = "cve", delta = 0.03, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4p(N, P, DEFF=3.45, conf=0.95, error = "rme", delta = 0.03, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4p(N, P, DEFF=3.45, conf=0.95, error = "me", delta = 0.03, plot=TRUE)