Learn R Programming

odr (version 1.7.3)

Optimal Design and Statistical Power for Experimental Studies Investigating Main, Mediation, and Moderation Effects

Description

Calculate the optimal sample size allocation that uses the minimum resources to achieve targeted statistical power in experiments. Perform power analyses with and without accommodating costs and budget. The designs cover single-level and multilevel experiments detecting main, mediation, and moderation effects (and some combinations). The references for the proposed methods include: (1) Shen, Z., & Kelcey, B. (2020). Optimal sample allocation under unequal costs in cluster-randomized trials. Journal of Educational and Behavioral Statistics, 45(4): 446-474. . (2) Shen, Z., & Kelcey, B. (2022b). Optimal sample allocation for three-level multisite cluster-randomized trials. Journal of Research on Educational Effectiveness, 15 (1), 130-150. . (3) Shen, Z., & Kelcey, B. (2022a). Optimal sample allocation in multisite randomized trials. The Journal of Experimental Education, 90(3), 693-711. . (4) Shen, Z., Leite, W., Zhang, H., Quan, J., & Kuang, H. (2025). Using ant colony optimization to identify optimal sample allocations in cluster-randomized trials. The Journal of Experimental Education, 93(1), 167-185. . (5) Shen, Z., Li, W., & Leite, W. (in press). Statistical power and optimal design for randomized controlled trials investigating mediation effects. Psychological Methods. . (6) Champely, S. (2020). pwr: Basic functions for power analysis (Version 1.3-0) [Software]. Available from .

Copy Link

Version

Install

install.packages('odr')

Monthly Downloads

216

Version

1.7.3

License

GPL-3

Maintainer

Zuchao Shen

Last Published

October 31st, 2025

Functions in odr (1.7.3)

od.2.221

Optimal sample allocation calculation for two-level CRTs probing mediation effects with cluster-level mediators
odr-package

Optimal Design and Statistical Power for Experimental Studies Investigating Main, Mediation, and Moderation Effects
od.4

Optimal sample allocation calculation for four-level CRTs detecting main effects
power.1.111

Budget and/or sample size, power, MDES calculation for single-level randomized controlled trials (RCTs) investigating mediation effects
power.1.111m

Budget and/or sample size, power, MDES calculation for single-level randomized controlled trials (RCTs) investigating moderation effects (1-1-1m)
od.2m.only.mod

Using the first-order derivative method to identify the optimal sample allocations for moderation effects in two-level multisite randomized trials (MRTs)
od.2m.mod

Optimal sample allocation identification for two-level multisite randomized trials (MRTs) investigating main and moderation effects
od.4m

Optimal sample allocation calculation for four-level MRTs detecting main effects
od.3

Optimal sample allocation calculation for three-level CRTs detecting main effects
od.3m

Optimal sample allocation calculation for three-level MRTs detecting main effects
power.2m.111

Budget and/or sample size, power, MDES calculation for MRTs investigating mediation effects with individual-level mediators
power.2

Budget and/or sample size, power, MDES calculation for two-level CRTs detecting main effects
power.4

Budget and/or sample size, power, MDES calculation for four-level CRTs detecting main effects
power.3m

Budget and/or sample size, power, MDES calculation for three-level MRTs detecting main effects
power.2.221

Budget and/or sample size, power calculation for CRTs probing mediation effects with cluster-level mediators
rpe

Relative precision and efficiency (RPE) calculation
power.1

Budget and/or sample size, power, MDES calculation for single-level experiments detecting main effects
power.2m.mod

Statistical power, sample size (and/or budget), minimum detectable moderator effect size calculation for two-level multisite randomized trials (MRTs) detecting moderation effects
re

Relative efficiency (RE) calculation
power.4m

Budget and/or sample size, power, MDES calculation for four-level MRTs detecting main effects
power.3

Budget and/or sample size, power, MDES calculation for three-level CRTs detecting main effects
power.2m

Budget and/or sample size, power, MDES calculation for two-level MRTs detecting main effects
power.2m.111m

Budget and/or sample size, power, MDES calculation for two-level MRTs detecting moderation effects with moderators at level 1
plot.power

Plot statistical power curves under a fixed budget across optimal design parameters
od.2m.111m

Optimal sample allocation identification for two-level multisite randomized trials investigating main and moderation effects with individual-level moderators
od.2m.111

Optimal sample allocation calculation for two-level multisite-randomized trials investigating mediation effects with individual-level mediators (1-1-1)
od.1

Optimal sample allocation calculation for single-level experiments detecting main effects
od.2m

Optimal sample allocation calculation for two-level MRTs detecting main effects
od.2.221m

Optimal sample allocation calculation for two-level CRTs probing moderation effects with cluster-level moderators
od.1.111

Optimal sample allocation calculation for single-level randomized controlled trials (RCTs) investigating mediation effects (1-1-1)
od.1.111m

Jointly optimal sample allocation identification for single-level randomized controlled trials (RCTs) investigating main and moderation effects (1-1-1m)
gen.design.pars

Generate optimal design parameters using ant colony optimization
od.2

Optimal sample allocation calculation for two-level CRTs detecting main effects