R/statpsych1.R
size.ci.lc.mean.ws.Rd
Computes the sample size required to estimate a linear contrast of population means with desired confidence interval precision in a within-subjects design. Set the variance planning value to the largest value within a plausible range for a conservatively large sample size. Set the Pearson correlation planning value to the smallest value within a plausible range for a conservatively large sample size.
size.ci.lc.mean.ws(alpha, var, cor, w, q)
alpha level for 1-alpha confidence
planning value of average variance of the measurements
planning value of average correlation between measurements
desired confidence interval width
vector of within-subjects contrast coefficients
Returns the required sample size
q <- c(.5, .5, -.5, -.5)
size.ci.lc.mean.ws(.05, 265, .8, 10, q)
#> Sample size
#> 11
# Should return:
# Sample size
# 11