Computes the minimum number of clusters (level-2 units) needed so that the confidence interval on a level-1 fixed-effect slope has expected full width no larger than \(\omega\) (Kelley, 2007; Raudenbush & Liu, 2001; Snijders & Bosker, 2012). The function inverts the closed-form approximation for the variance of a fixed-effect slope in a balanced two-level random-intercept model.
ss_aipe_mixed_effects(
sigma2_y,
sigma2_x,
icc,
width,
cluster_size = 20L,
conf_level = 0.95
)A data.frame with rows for the recommended
number of clusters necessary_n_clusters, the implied total
sample size total_N (necessary_n_clusters *
cluster_size), the target width, the intraclass
correlation icc, the cluster_size, and the resulting
ci_width_expected (the expected full CI width at the
recommended size).
Total variance of the outcome variable.
Variance of the level-1 predictor (covariate).
Intraclass correlation of the outcome.
Target full CI width on the slope.
Per-cluster sample size (number of level-1
units per level-2 unit). Default 20L.
Confidence level. Default 0.95.
Ken Kelley [email protected]
Variance of the slope. For a level-1 predictor centered within cluster, the asymptotic variance of \(\hat\beta\) is approximately $$\mathrm{Var}(\hat\beta) \;\approx\; \frac{\sigma^2_y (1 - \rho_I)}{N \sigma^2_x},$$ where \(N = n_{\mathrm{clusters}} \cdot m\) is the total number of level-1 units, \(m\) is the cluster size, and \(\rho_I\) the intraclass correlation. Because within-cluster centering removes the cluster-level variation from the predictor, the design effect \(1 + (m - 1) \rho_I\) that inflates the variance of a cluster-level estimand does not appear here; clustering enters only through the residual variance \(\sigma^2_y (1 - \rho_I)\). The function inverts this expression for \(N\). No anticipated slope value is needed: \(\beta\) does not appear in the variance, so the recommended number of clusters is the same whatever the slope.
Scope. Planning is for the most common single-level covariate case (random intercept, fixed slope, level-1 predictor centered within cluster). For cross-level interactions or random slopes, the variance formula changes and a Monte Carlo planner should be used instead (Schoemann, Boulton, & Short, 2017).
Kelley, K. (2007). Confidence intervals for standardized effect sizes: Theory, application, and implementation. Journal of Statistical Software, 20(8), 1--24. tools:::Rd_expr_doi("10.18637/jss.v020.i08")
Raudenbush, S. W., & Liu, X.-F. (2001). Effects of study duration, frequency of observation, and sample size on power in studies of group differences in polynomial change. Psychological Methods, 6(4), 387--401. tools:::Rd_expr_doi("10.1037/1082-989X.6.4.387")
Schoemann, A. M., Boulton, A. J., & Short, S. D. (2017). Determining power and sample size for simple and complex mediation models. Social Psychological and Personality Science, 8(4), 379--386. tools:::Rd_expr_doi("10.1177/1948550617715068")
Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel analysis: An introduction to basic and advanced multilevel modeling (2nd ed.). Sage.
ss_power_mixed_effects, var_icc,
ss_aipe_icc
design_consequences for what a chosen design delivers:
power, the Type S (sign) and Type M (exaggeration) errors of the
significance filter, and the expected confidence interval width.
Other sample size for power:
power_fisher_exact(),
ss_power_R2(),
ss_power_R2_sensitivity(),
ss_power_c(),
ss_power_c_ancova(),
ss_power_composite_ancova(),
ss_power_composite_ancova_2group(),
ss_power_composite_anova(),
ss_power_composite_factorial_ancova(),
ss_power_composite_factorial_ancova_het(),
ss_power_composite_factorial_anova(),
ss_power_composite_sem(),
ss_power_contrast(),
ss_power_equivalence_c(),
ss_power_factorial_ancova(),
ss_power_factorial_anova(),
ss_power_indirect_effect(),
ss_power_mixed_effects(),
ss_power_one_way_anova(),
ss_power_pcm(),
ss_power_r(),
ss_power_rc(),
ss_power_reg_coef(),
ss_power_reg_coef_sensitivity(),
ss_power_rm_anova(),
ss_power_sc(),
ss_power_sem(),
ss_power_smd(),
ss_power_split_plot_anova()
Other mixed models:
R2_mixed_effects(),
R2_mixed_effects_decomposition(),
icc_lmer(),
manova_split_plot(),
mixed_anova(),
ss_aipe_mixed_effects_sensitivity(),
ss_power_mixed_effects(),
ss_power_split_plot_anova()
# 1. Plan a two-level study with cluster size 20, ICC = 0.10,
# sigma_y = 1, sigma_x = 1, target CI width = 0.20:
ss_aipe_mixed_effects(sigma2_y = 1, sigma2_x = 1, icc = 0.10,
width = 0.20, cluster_size = 20)
# 2. The same study with stronger clustering (ICC = 0.20):
ss_aipe_mixed_effects(sigma2_y = 1, sigma2_x = 1, icc = 0.20,
width = 0.20, cluster_size = 20)
Run the code above in your browser using DataLab