ss4pH {samplesize4surveys} | R Documentation |
The required sample size for testing a null hyphotesis for a single proportion
Description
This function returns the minimum sample size required for testing a null hyphotesis regarding a single proportion.
Usage
ss4pH(N, p, p0, DEFF = 1, conf = 0.95, power = 0.8, plot = FALSE)
Arguments
N |
The population size. |
p |
The value of the estimated proportion. |
p0 |
The value to test for the single proportion. |
DEFF |
The design effect of the sample design. By default |
conf |
The statistical confidence. By default |
power |
The statistical power. By default |
plot |
Optionally plot the effect against the sample size. |
Details
We assume that it is of interest to test the following set of hyphotesis:
H_0: P - P_0 = 0 \ \ \ \ vs. \ \ \ \ H_a: P - P_0 = D \neq 0
Note that the minimun sample size, restricted to the predefined power \beta
and confidence 1-\alpha
, is defined by:
n = \frac{S^2}{\frac{D^2}{(z_{1-\alpha} + z_{\beta})^2}+\frac{S^2}{N}}
Where
S^2=p(1-p)DEFF
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
ss4pH(N = 10000, p = 0.5, p0 = 0.55)
ss4pH(N = 10000, p = 0.5, p0 = 0.55, plot=TRUE)
ss4pH(N = 10000, p = 0.5, p0 = 0.55, DEFF = 2, plot=TRUE)
ss4pH(N = 10000, p = 0.5, p0 = 0.55, conf = 0.99, power = 0.9, DEFF = 2, plot=TRUE)
#############################
# Example with BigLucy data #
#############################
data(BigLucy)
attach(BigLucy)
N <- nrow(BigLucy)
p <- prop.table(table(SPAM))[1]
# The minimum sample size for testing
# H_0: P - P_0 = 0 vs. H_a: P - P_0 = D = 0.1
D = 0.1
p0 = p - D
ss4pH(N, p, p0, conf = 0.99, power = 0.9, DEFF = 2, plot=TRUE)
# The minimum sample size for testing
# H_0: P - P_0 = 0 vs. H_a: P - P_0 = D = 0.02
D = 0.02
p0 = p - D
ss4pH(N, p, p0, conf = 0.99, power = 0.9, DEFF = 3.45, plot=TRUE)