Description Usage Arguments Details Author(s) References See Also Examples
This function returns the minimum sample size required for testing a null hyphotesis regarding a single difference of proportions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
N |
The maximun population size between the groups (strata) that we want to compare. |
mu1 |
The value of the estimated mean of the variable of interes for the first population. |
mu2 |
The value of the estimated mean of the variable of interes for the second population. |
sigma1 |
The value of the estimated variance of the variable of interes for the first population. |
sigma2 |
The value of the estimated mean of a variable of interes for the second population. |
D |
The minimun effect to test. |
DEFF |
The design effect of the sample design. By default |
conf |
The statistical confidence. By default |
power |
The statistical power. By default |
T |
The overlap between waves. By default |
R |
The correlation between waves. By default |
plot |
Optionally plot the effect against the sample size. |
We assume that it is of interest to test the following set of hyphotesis:
H_0: mu_1 - mu_2 = 0 \ \ \ \ vs. \ \ \ \ H_a: mu_1 - mu_2 = D \neq 0
Note that the minimun sample size, restricted to the predefined power β and confidence 1-α, is defined by:
n = \frac{S^2}{\frac{D^2}{(z_{1-α} + z_{β})^2}+\frac{S^2}{N}}
where S^2=(σ_1^2 + σ_2^2) * (1 - (T * R)) * DEFF
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 27 28 29 30 31 32 | ss4dmH(N = 100000, mu1=50, mu2=55, sigma1 = 10, sigma2 = 12, D=3)
ss4dmH(N = 100000, mu1=50, mu2=55, sigma1 = 10, sigma2 = 12, D=1, plot=TRUE)
ss4dmH(N = 100000, mu1=50, mu2=55, sigma1 = 10, sigma2 = 12, D=0.5, DEFF = 2, plot=TRUE)
ss4dmH(N = 100000, mu1=50, mu2=55, sigma1 = 10, sigma2 = 12, D=0.5, DEFF = 2, conf = 0.99,
power = 0.9, plot=TRUE)
#############################
# Example with BigLucy data #
#############################
data(BigLucy)
attach(BigLucy)
N1 <- table(SPAM)[1]
N2 <- table(SPAM)[2]
N <- max(N1,N2)
BigLucy.yes <- subset(BigLucy, SPAM == 'yes')
BigLucy.no <- subset(BigLucy, SPAM == 'no')
mu1 <- mean(BigLucy.yes$Income)
mu2 <- mean(BigLucy.no$Income)
sigma1 <- sd(BigLucy.yes$Income)
sigma2 <- sd(BigLucy.no$Income)
# The minimum sample size for testing
# H_0: mu_1 - mu_2 = 0 vs. H_a: mu_1 - mu_2 = D = 3
D = 3
ss4dmH(N, mu1, mu2, sigma1, sigma2, D, DEFF = 2, plot=TRUE)
# The minimum sample size for testing
# H_0: mu_1 - mu_2 = 0 vs. H_a: mu_1 - mu_2 = D = 3
D = 3
ss4dmH(N, mu1, mu2, sigma1, sigma2, D, conf = 0.99, power = 0.9, DEFF = 3.45, plot=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.