DMAR DMAR hex logo

R-CMD-check CRAN status Lifecycle: stable DOI

DMAR (Design, Measurement, and Analysis in R, pronounced “Dee-Mar”) is a package for human-centered research: effect sizes, confidence intervals for effect sizes, sample size planning, reliability and agreement, mediation analysis (from the simple mediation model to likelihood ratio tests of arbitrary indirect effects, with moderated mediation probing), equivalence testing, meta-analysis, experimental and quasi-experimental designs, repeated measures, and model comparison-based inference. It draws on the psychometric and statistical traditions and reflects the methodological and applied research program of its author, Ken Kelley (University of Notre Dame). It aims to be methodologically sound and useful across psychology, sociology, education, management, marketing, and information systems, especially where the independent or dependent variables involve the person.

Installation

# The released version, from CRAN:
install.packages("DMAR")

# The development version, from GitHub:
# install.packages("remotes")
remotes::install_github("yelleKneK/DMAR")

Each CRAN release is tagged on GitHub (v1.0.0 for the first); between releases the GitHub copy carries the changes of the next one, listed in NEWS.

R >= 4.0.0 is required. Most estimation, inference, and planning functions return a tidy data.frame(term, value) that composes naturally with dplyr / ggplot2 pipelines and with broom::tidy() / broom::glance(). Heavier dependencies (e.g., lavaan, lme4, OpenMx) are in Suggests and gated by requireNamespace(); install them only when you need the functions that use them.

Function Families

DMAR is organized into these function families:

Canonical Examples

1. Standardized Mean Difference With a Noncentral t Confidence Interval

library(DMAR)

# From summary statistics:
smd(mean_1 = 60, mean_2 = 55, s_1 = 10, s_2 = 10, n_1 = 30, n_2 = 30)
term value
smd 0.500

# CI on the standardized mean difference (Cohen's d) via the noncentral t:
ci_smd(smd = 0.5, n_1 = 30, n_2 = 30, conf_level = 0.95)
term value
ci_lower -0.016
smd 0.500
ci_upper 1.012

Confidence level: 95%

2. R² With a Noncentral F Confidence Interval and AIPE Sample Size

ci_R2(R2 = 0.30, N = 100, p = 4, conf_level = 0.95)
term value prob_less prob_greater
ci_lower 0.130 0.025 0.975
R2 0.300 NA NA
ci_upper 0.430 0.975 0.025

Confidence level: 95%


# What N is needed so the 95% CI on R^2 has full width <= 0.20?
ss_aipe_R2(true_R2 = 0.30, width = 0.20, p = 4)
term value
necessary_N 228

Confidence level: 95%

3. AIPE Planning With a Sensitivity Check

# Plan N for a half-width of .10 on the SMD at a population SMD of 0.40.
ss_aipe_smd(true_smd = 0.40, width = 0.20)
term value
necessary_n_per_group 784
true_smd 0.400
width 0.200

Confidence level: 95%


# How does that plan hold up if the population SMD is actually 0.25?
set.seed(113)
ss_aipe_smd_sensitivity(
  true_smd      = 0.25,
  supposed_smd  = 0.40,
  width         = 0.20,
  G               = 200,
  print_iter      = FALSE
)
term value
mean_smd 0.253
median_smd 0.249
sd_smd 0.052
mean_ci_width 0.199
median_ci_width 0.199
sd_ci_width 0.000
mean_ci_width_lower 0.099
mean_ci_width_upper 0.099
pct_ci_less_width 1.000
pct_ci_miss_low 0.030
pct_ci_miss_high 0.025
total_type_I_error 0.055
n_per_group 784
total_N 1568
true_smd 0.250
supposed_smd 0.400
width 0.200
conf_level 0.950

Replications: 200

Confidence level: 95%

4. Welch’s t Test With a Tidy Return

set.seed(113)
x <- rnorm(20, mean = 100, sd = 15)
y <- rnorm(20, mean = 110, sd = 25)
welch_t(x, y, conf_level = 0.95)
term value
mean_difference -16.871
t_value -2.410
df 28.349
p_value 0.0227
ci_lower -31.204
ci_upper -2.537
mean_x 100.297
mean_y 117.168
sd_x 14.289
sd_y 27.860
n_x 20
n_y 20

Confidence level: 95%

5. Reliability With a Confidence Interval

# Cronbach's alpha plus the Bonett (2002) CI from a covariance matrix.
S <- matrix(
  c(1.0, 0.6, 0.5, 0.5,
    0.6, 1.0, 0.6, 0.5,
    0.5, 0.6, 1.0, 0.6,
    0.5, 0.5, 0.6, 1.0),
  nrow = 4)
reliability_alpha(S = S, N = 250, ci_method = "bonett")
term value
estimate 0.830
se 0.018
se_transformed 0.104
ci_lower 0.792
ci_upper 0.861
conf_level 0.950
N 250
N_complete 250
n_items 4

6. Kish’s Design Effect in a Clustered Sample

# 25 schools with attendance ranging from 0 (closed) to 30 (full class),
# ICC = .10. How much clustering information do we actually have?
sizes <- c(0, 0, 1, 1, 1, 2, 3, 5, 8, 10, 12, 15, 18, 20, 22,
           22, 25, 26, 28, 28, 30, 30, 30, 30, 30)
design_effect(cluster_sizes = sizes, icc = 0.10)
term value
design_effect 3.327
deft 1.824
effective_n 119.328
N 397
n_clusters_total 25
n_clusters_with_data 23
n_clusters_empty 2
n_clusters_singletons 3
n_clusters_informative 20
m_bar 17.261
m_kish 24.270
icc 0.100

Numerical Validation

DMAR ships a dedicated numerical-correctness test suite (tests/testthat/test-numerical-correctness.R and companion files) that pins its output against authoritative reference implementations and published values, so results are reproducible and checkable:

Quantity Reference Agreement
Confidence intervals for R², SMD; noncentral t / F limits; AIPE sample sizes MBESS 1e-5 to 1e-6 (integer N)
Within-subjects sphericity epsilons; factorial ANOVA / ANCOVA car machine precision
CFA, coefficient omega, RMSEA lavaan, semTools machine precision
krippendorff_alpha(), gwet_ac() irr, irrCAC machine precision (validated designs)
R2_mixed_effects() (Nakagawa & Schielzeth), R2_mixed_effects_decomposition() (Rights & Sterba) r2mlm machine precision (validated model classes)
Multiple-comparison critical values and CIs multcomp, published tables published values
Dunnett’s T3; the paired-proportion score interval; Fieller’s ratio of means; bifactor and second-order omegas PMCMRplus, PropCIs, mratios, semTools pinned values, compared live by the maintainer’s release tooling

The machine-precision rows hold for the model and design classes the test suite pins, including the boundary cases the tests cover. The mixed-effects R-squared functions match r2mlm and the direct Johnson quadratic form across random-intercept, correlated random-slope, split (||) random-slope, multi-slope, and nested two-level models; on split random-slope models performance/insight omits the random-slope variance, so DMAR agrees with r2mlm and the Johnson form there and not with performance. The agreement procedures match irr and irrCAC on the ordinary rating designs and on the boundary cases the tests cover: the zero-distance case of ratio-metric Krippendorff’s alpha, all-missing units in gwet_ac(), and incomplete category sets in cohen_kappa().

Learn More

Relation to MBESS

DMAR is a more general and greatly expanded reimagining of the MBESS package (Kelley, 2007a, Journal of Statistical Software, 20(8), 1–24; 2007b, Behavior Research Methods, 39(4), 979–984), which has been on CRAN for about two decades. MBESS was named for the behavioral, educational, and social sciences, but the methods it implements apply across the empirical sciences, and DMAR is framed for that broader range. The notational and programming changes (uniform snake_case, tidy data.frame(term, value) returns, native ggplot2 plotting, broader coverage of within-subjects, multivariate, mixed-effects, and sequential-estimation methods) were too extensive to ship under the MBESS name without breaking compatibility, so the work ships under a new name. MBESS remains on CRAN, and new methods are added to DMAR. See vignette("mbess_to_dmar") for the MBESS → DMAR migration mapping.

Relation to Maxwell, Delaney, and Kelley (MDK, 4th ed.)

Many of the methods in DMAR are discussed in Maxwell, Delaney, and Kelley (2027), Designing Experiments and Analyzing Data: A Model Comparison Perspective (4th ed., Routledge). Functions cite the specific MDK chapter in their @references block where the underlying method is discussed in detail. DMAR is broader than MDK: it covers methods (e.g., minimum risk sequential estimation, equivalence testing, mediation effect size CIs, design effects for cluster sampling) that are outside the scope of a textbook on experimental design. Conversely, MDK covers conceptual material that falls outside the scope of an R package. The two are complementary.

BUCSS (Bias and Uncertainty Corrected Sample Size; Kelley, Anderson, and Maxwell) plans the sample size of a future study for statistical power from the summary statistics of a prior study, correcting the prior study’s effect for publication bias and for uncertainty. Ken Kelley is a coauthor of BUCSS. Its planners cover many of the designs of DMAR’s ss_power_*() family; DMAR’s power planners take the planning effect as given, and DMAR’s ss_aipe_*() planners plan for the width of a confidence interval rather than for power.

Citation

If you use DMAR in published work, please cite

Kelley, K. (2026). DMAR: Design, Measurement, and Analysis in R. R package version 1.1.0. https://doi.org/10.5281/zenodo.22960335

and, where appropriate, the original MBESS references for the methodological lineage:

Kelley, K. (2007). Confidence Intervals for Standardized Effect Sizes: Theory, Application, and Implementation. Journal of Statistical Software, 20(8), 1–24. doi:10.18637/jss.v020.i08

Kelley, K. (2007). Methods for the Behavioral, Educational, and Social Sciences: An R package. Behavior Research Methods, 39(4), 979–984. doi:10.3758/BF03192993

citation("DMAR") reproduces the canonical BibTeX entry from R.

Feedback

Bug reports, feature requests, and suggestions for new methods are welcomed by email to Ken Kelley kkelley@nd.edu (please put “DMAR” in the subject line). See https://kenkelley.org and https://kenkelley.org/publications/ for related publications.