R/statpsych1.R
size.ci.lc.stdmean.ws.Rd
Computes the sample size required to estimate two types of standardized linear contrasts of population means (unweighted standardizer and single level standardizer) with desired confidence interval precision in a within-subjects design. For a conservatively large sample size, set the standardized linear contrast of means planning value to the largest value within a plausible range, and set the Pearson correlation planning value to the smallest value within a plausible range.
size.ci.lc.stdmean.ws(alpha, d, cor, w, q)
alpha level for 1-alpha confidence
planning value of standardized linear contrast
planning value of average correlation between measurements
desired confidence interval width
vector of within-subjects contrast coefficients
Returns the required sample size for each standardizer
Bonett DG (2009). “Estimating standardized linear contrasts of means with desired precision.” Psychological Methods, 14(1), 1--5. ISSN 1939-1463, doi:10.1037/a0014270 .
q <- c(.5, .5, -.5, -.5)
size.ci.lc.stdmean.ws(.05, 1, .7, .6, q)
#> Sample size
#> Unweighted standardizer: 26
#> Single level standardizer: 35
# Should return:
# Sample size
# Unweighted standardizer: 26
# Single level standardizer: 35