Package: odr 1.8.3

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

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. <doi:10.3102/1076998620912418>. (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. <doi:10.1080/19345747.2021.1953200>. (3) Shen, Z., & Kelcey, B. (2022a). Optimal sample allocation in multisite randomized trials. The Journal of Experimental Education, 90(3), 693-711. <doi:10.1080/00220973.2020.1830361>. (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. <doi:10.1080/00220973.2024.2306392>. (5) Shen, Z., Li, W., & Leite, W. (in press). Statistical power and optimal design for randomized controlled trials investigating mediation effects. Psychological Methods. <doi:10.1037/met0000698>. (6) Champely, S. (2020). pwr: Basic functions for power analysis (Version 1.3-0) [Software]. Available from <https://CRAN.R-project.org/package=pwr>.

Authors:Zuchao Shen [aut, cre], Benjamin Kelcey [aut]

odr_1.8.3.tar.gz
odr_1.8.3.zip(r-4.7)odr_1.8.3.zip(r-4.6)odr_1.8.3.zip(r-4.5)
odr_1.8.3.tgz(r-4.6-any)odr_1.8.3.tgz(r-4.5-any)
odr_1.8.3.tar.gz(r-4.7-any)odr_1.8.3.tar.gz(r-4.6-any)
odr_1.8.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
odr/json (API)

# Install 'odr' in R:
install.packages('odr', repos = c('https://zuchaoshen.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/zuchaoshen/odr/issues

On CRAN:

Conda:

3.92 score 21 scripts 235 downloads 31 exports 0 dependencies

Last updated from:199820882c. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK136
source / vignettesOK167
linux-release-x86_64OK178
macos-release-arm64OK126
macos-oldrel-arm64OK105
windows-develOK148
windows-releaseOK103
windows-oldrelOK131
wasm-releaseOK88

Exports:gen.design.parsod.1od.1.111od.1.111mod.2od.2.221od.2.modod.2mod.2m.111od.2m.modod.2m.only.modod.3od.3mod.4od.4mplot.powerpower.1power.1.111power.1.111mpower.2power.2.221power.2.modpower.2mpower.2m.111power.2m.modpower.3power.3mpower.4power.4mrerpe

Dependencies:

Package 'odr'

Rendered fromodr.Rmdusingknitr::rmarkdownon May 12 2026.

Last update: 2026-02-11
Started: 2021-08-29

Readme and manuals

Help Manual

Help pageTopics
Optimal Design and Statistical Power for Experimental Studies Investigating Main, Mediation, and Moderation Effectsodr-package odr
Generate optimal design parameters using ant colony optimizationgen.design.pars
Optimal sample allocation calculation for single-level experiments detecting main effectsod.1
Optimal sample allocation calculation for single-level randomized controlled trials (RCTs) investigating mediation effects (1-1-1)od.1.111
Jointly optimal sample allocation identification for single-level randomized controlled trials (RCTs) investigating main and moderation effects (1-1-1m)od.1.111m
Optimal sample allocation calculation for two-level CRTs detecting main effectsod.2
Optimal sample allocation calculation for two-level CRTs probing mediation effects with cluster-level mediatorsod.2.221
Optimal sample allocation calculation for two-level CRTs probing moderation effects with cluster-level moderatorsod.2.mod
Optimal sample allocation calculation for two-level MRTs detecting main effectsod.2m
Optimal sample allocation calculation for two-level multisite-randomized trials investigating mediation effects with individual-level mediators (1-1-1)od.2m.111
Optimal sample allocation identification for two-level multisite randomized trials (MRTs) investigating main and moderation effectsod.2m.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.only.mod
Optimal sample allocation calculation for three-level CRTs detecting main effectsod.3
Optimal sample allocation calculation for three-level MRTs detecting main effectsod.3m
Optimal sample allocation calculation for four-level CRTs detecting main effectsod.4
Optimal sample allocation calculation for four-level MRTs detecting main effectsod.4m
Plot statistical power curves under a fixed budget across optimal design parametersplot.power
Budget and/or sample size, power, MDES calculation for single-level experiments detecting main effectspower.1
Budget and/or sample size, power, MDES calculation for single-level randomized controlled trials (RCTs) investigating mediation effectspower.1.111
Budget and/or sample size, power, MDES calculation for single-level randomized controlled trials (RCTs) investigating moderation effects (1-1-1m)power.1.111m
Budget and/or sample size, power, MDES calculation for two-level CRTs detecting main effectspower.2
Budget and/or sample size, power calculation for CRTs probing mediation effects with cluster-level mediatorspower.2.221
Statistical power, sample size (and/or budget), minimum detectable moderator effect size calculation for two-level cluster-randomized trials (CRTs) detecting moderation effectspower.2.mod
Budget and/or sample size, power, MDES calculation for two-level MRTs detecting main effectspower.2m
Budget and/or sample size, power, MDES calculation for MRTs investigating mediation effects with individual-level mediatorspower.2m.111
Statistical power, sample size (and/or budget), minimum detectable moderator effect size calculation for two-level multisite randomized trials (MRTs) detecting moderation effectspower.2m.mod
Budget and/or sample size, power, MDES calculation for three-level CRTs detecting main effectspower.3
Budget and/or sample size, power, MDES calculation for three-level MRTs detecting main effectspower.3m
Budget and/or sample size, power, MDES calculation for four-level CRTs detecting main effectspower.4
Budget and/or sample size, power, MDES calculation for four-level MRTs detecting main effectspower.4m
Relative efficiency (RE) calculationre
Relative precision and efficiency (RPE) calculationrpe