Description Usage Arguments Details Author(s) References See Also Examples
This function returns the minimum sample size required for estimating a double difference of proportion subjecto to predefined errors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
N |
The population size. |
P1 |
The value of the first estimated proportion at first wave. |
P2 |
The value of the second estimated proportion at first wave. |
P3 |
The value of the first estimated proportion at second wave. |
P4 |
The value of the second estimated proportion at second wave. |
DEFF |
The design effect of the sample design. By default |
conf |
The statistical confidence. By default conf = 0.95. By default |
cve |
The maximun coeficient of variation that can be allowed for the estimation. |
me |
The maximun margin of error that can be allowed for the estimation. |
T |
The overlap between waves. By default |
R |
The correlation between waves. By default |
plot |
Optionally plot the errors (cve and margin of error) against the sample size. |
Note that the minimun sample size (for each group at each wave) 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{α}{2}}S^2}{\varepsilon^2}
and
S^2 = (P1 * Q1 + P2 * Q2 + P3 * Q3 + P4 * Q4) * (1 - (T * R)) * DEFF
Also note that the minimun sample size to achieve a particular coefficient of variation cve is defined by:
n = \frac{S^2}{(ddp)^2cve^2+\frac{S^2}{N}}
And ddp is the expected estimate of the double difference of proportions.
Hugo Andres Gutierrez Rojas <hagutierrezro at gmail.com>
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ss4ddp(N=100000, P1=0.05, P2=0.55, P3= 0.5, P4= 0.6, cve=0.05, me=0.03)
ss4ddp(N=100000, P1=0.05, P2=0.55, P3= 0.5, P4= 0.6, cve=0.05, me=0.03, plot=TRUE)
ss4ddp(N=100000, P1=0.05, P2=0.55, P3= 0.5, P4= 0.6, DEFF=3.45, conf=0.99,
cve=0.03, me=0.03, plot=TRUE)
ss4ddp(N=100000, P1=0.05, P2=0.55, P3= 0.5, P4= 0.6, DEFF=3.45, conf=0.99,
cve=0.03, me=0.03, T = 0.5, R = 0.9, plot=TRUE)
#################################
# Example with BigLucyT0T1 data #
#################################
data(BigLucyT0T1)
attach(BigLucyT0T1)
BigLucyT0 <- BigLucyT0T1[Time == 0,]
BigLucyT1 <- BigLucyT0T1[Time == 1,]
N1 <- table(BigLucyT0$SPAM)[1]
N2 <- table(BigLucyT1$SPAM)[1]
N <- max(N1,N2)
P1 <- prop.table(table(BigLucyT0$ISO))[1]
P2 <- prop.table(table(BigLucyT1$ISO))[1]
P3 <- prop.table(table(BigLucyT0$ISO))[2]
P4 <- prop.table(table(BigLucyT1$ISO))[2]
# The minimum sample size for simple random sampling
ss4ddp(N, P1, P2, P3, P4, conf=0.95, cve=0.05, me=0.03, plot=TRUE)
# The minimum sample size for a complex sampling design
ss4ddp(N, P1, P2, P3, P4, T = 0.5, R = 0.5, conf=0.95, cve=0.05, me=0.03, plot=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.