Compute a simple random sample size for estimating the difference in means when samples overlap
nDep2sam(S2x, S2y, g, r, rho, alt, del, sig.level=0.05, pow=0.80)
List with values:
sample size in group 1
sample size in group 2
unit variances in groups 1 and 2
difference in group means to be detected
proportion of sample 1 that is in the overlap with sample 2
ratio of the size of sample 1 to that of sample 2
unit-level correlation between analysis variables in groups 1 and 2
type of test: one-sided or two-sided
significance level of test
power of the test
unit variance of analysis variable x in sample 1
unit variance of analysis variable y in sample 2
proportion of sample 1 that is in the overlap with sample 2
ratio of the size of sample 1 to that of sample 2
unit-level correlation between x and y
should the test be 1-sided or 2-sided; allowable values are alt="one.sided"
or alt="two.sided"
.
size of the difference between the means to be detected
significance level of the hypothesis test
desired power of the test
Richard Valliant, Jill A. Dever, Frauke Kreuter
nDep2sam
computes sample sizes in two groups that are required for testing whether the difference in group means is significant. The power of the test is one of the input parameters. The samples have a specified proportion of units in common. Both samples are assumed to be selected via simple random sampling.
Valliant, R., Dever, J., Kreuter, F. (2018, chap. 4). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. New York: Springer.
Woodward, M. (1992). Formulas for Sample Size, Power, and Minimum Detectable Relative Risk in Medical Studies. The Statistician, 41, 185-196.
nProp2sam
nDep2sam(S2x=200, S2y=200,
g=0.75, r=1, rho=0.9,
alt="one.sided", del=5,
sig.level=0.05, pow=0.80)
Run the code above in your browser using DataLab