Computes the sample size required to estimate a slope coefficient with desired confidence interval precision in any type of statistical model. This function requires a standard error estimate for the slope of interest from a prior or pilot study and the sample size that was used in the prior or pilot study. This function can be used for both unstandardized and standardized slopes. This function also can be used for both unstandardized and standardized factor loadings in a confirmatory factor analysis model. This function will soon be replaced with size.ci.gen.
size.ci.slope.gen(alpha, se, n0, w)
Returns the required sample size
alpha level for 1-alpha confidence
standard error of slope from prior/pilot study
sample size used in prior/pilot study
desired confidence interval width
size.ci.slope.gen(.05, 3.15, 50, 5)
# Should return:
# Sample size
# 305
Run the code above in your browser using DataLab