Two-stage meta-regression workflow that first removes variation associated with methodology moderators, then models the adjusted effect sizes with substantive moderators.

masmr(
  data,
  methodology_mods,
  substantive_mods,
  formula = NULL,
  studyID,
  effectID = NULL,
  sample_size = NULL,
  effectsize_type = NULL,
  effectsize_name = NULL,
  estimation_method = "REML",
  variance = NULL,
  varcov_type,
  weights = NULL,
  structure = "univariate",
  intercept = FALSE,
  missing = "remove",
  optim_method = "L-BFGS-B",
  robustID = NULL,
  lasso = FALSE,
  lasso_args = list(lambda_grid = 10^seq(1, -3, length.out = 5), K = 5, all_lasso_metrics
    = FALSE, lambda_tolerance = 0),
  tol = 1e+07,
  adjusted_effect_name = "yi_masmr",
  ...
)

Arguments

data

Data frame used for analysis.

methodology_mods

Character vector of methodology moderator terms.

substantive_mods

Character vector of substantive moderator terms.

formula

Optional formula input for univariate/multilevel analysis.

studyID

Study identifier column name.

effectID

Effect identifier column name (used for SMD-style workflow).

sample_size

Sample-size column name (used for SMD-style workflow).

effectsize_type

Effect size type. Currently supports "smd" for the multivariate-style workflow.

effectsize_name

Effect-size column name.

estimation_method

Estimation method passed to mars.

variance

Variance column name.

varcov_type

Variance-covariance type passed to mars.

weights

Optional user-defined weights.

structure

Model structure passed to mars.

intercept

Intercept flag passed to mars.

missing

Missing-data handling mode passed to mars.

optim_method

Optimization method passed to mars.

robustID

Optional robust clustering ID passed to mars.

lasso

LASSO flag passed to mars.

lasso_args

LASSO arguments passed to mars.

tol

Optimization tolerance passed to mars.

adjusted_effect_name

Name of adjusted effect-size column created between stage 1 and stage 2.

...

Additional arguments passed to mars.

Value

An object of class "masmr" containing:

stage1

Methodology-stage fitted mars model.

stage2

Substantive-stage fitted mars model.

adjusted_data

Stage-1 analysis data with adjusted effect sizes.

adjusted_effect_name

Name of adjusted effect-size column.

workflow

Either "formula" or "smd".

Examples

out <- masmr(
  data = teacher_expectancy,
  methodology_mods = c("factor(tester)"),
  substantive_mods = c("year", "weeks", "factor(setting)"),
  formula = yi ~ 1 + year + weeks + factor(setting) + factor(tester),
  studyID = "study",
  variance = "vi",
  varcov_type = "univariate",
  structure = "univariate"
)

summary(out)
#> Methodology-Adjusted Substantive Meta-Regression (MASMR)
#> Workflow: formula 
#> Methodology moderators: factor(tester) 
#> Substantive moderators: year, weeks, factor(setting) 
#> 
#> Stage 1 (Methodology Adjustment)
#> Results generated with MARS:v 0.5.1.1 
#> Thursday, April  2, 2026
#> 
#> Model Type: 
#> univariate
#> 
#> Estimation Method: 
#> Restricted Maximum Likelihood
#> 
#> Model Formula: 
#> yi ~ 1 + factor(tester)
#> <environment: 0x5652f6eccf18>
#> 
#> Data Summary: 
#> Number of Effect Sizes: 19
#> Number of Fixed Effects: 2
#> Number of Random Effects: 1
#> 
#> Random Components: 
#>       term     var     SD
#>  intercept 0.02476 0.1574
#> 
#> Fixed Effects Estimates: 
#>    attribute estimate      SE z_test p_value    lower  upper
#>  (Intercept)  0.04635 0.07187 0.6448  0.5190 -0.09452 0.1872
#>        blind  0.10248 0.11209 0.9142  0.3606 -0.11722 0.3222
#> 
#> Model Fit Statistics: 
#>  logLik   Dev   AIC   BIC  AICc
#>  -3.838 7.675 13.68 16.17 23.86
#> 
#> Q Error: 35.157 (17), p = 0.0059
#> 
#> I2 (General): 49.037
#> 
#> Residual Diagnostics: 
#>   n n_finite_raw mean_raw sd_raw  rmse    mae q_pearson mean_abs_studentized
#>  19           19  0.06879 0.3547 0.352 0.2418     22.86                0.907
#>  max_abs_studentized prop_abs_studentized_gt2 prop_abs_studentized_gt3
#>                2.846                   0.1053                        0
#> 
#> Normality (whitened residuals):                   test n_tested statistic p_value
#>  shapiro_wilk_whitened       19    0.9141 0.08801
#> 
#> Heteroscedasticity trend (|raw residual| ~ fitted):   n corr_abs_raw_fitted   slope p_value
#>  19             -0.1174 -0.5868  0.6322
#> 
#> Stage 2 (Substantive Model on Adjusted Effects)
#> Results generated with MARS:v 0.5.1.1 
#> Thursday, April  2, 2026
#> 
#> Model Type: 
#> univariate
#> 
#> Estimation Method: 
#> Restricted Maximum Likelihood
#> 
#> Model Formula: 
#> yi_masmr ~ 1 + year + weeks + factor(setting)
#> <environment: 0x5652f6eceb28>
#> 
#> Data Summary: 
#> Number of Effect Sizes: 19
#> Number of Fixed Effects: 4
#> Number of Random Effects: 1
#> 
#> Random Components: 
#>       term     var    SD
#>  intercept 0.01345 0.116
#> 
#> Fixed Effects Estimates: 
#>    attribute estimate        SE  z_test p_value     lower      upper
#>  (Intercept) 37.12140 53.047587  0.6998 0.48407 -66.84996 141.092756
#>         year -0.01872  0.026926 -0.6952 0.48693  -0.07149   0.034055
#>        weeks -0.01349  0.006082 -2.2184 0.02653  -0.02541  -0.001572
#>        indiv  0.16226  0.184128  0.8812 0.37819  -0.19862   0.523146
#> 
#> Model Fit Statistics: 
#>  logLik   Dev AIC   BIC  AICc
#>    -1.5 3.001  13 16.54 50.71
#> 
#> Q Error: 25.48 (15), p = 0.0439
#> 
#> I2 (General): 35.03433
#> 
#> Residual Diagnostics: 
#>   n n_finite_raw mean_raw sd_raw   rmse    mae q_pearson mean_abs_studentized
#>  19           19  0.05031 0.3186 0.3142 0.2032     19.35               0.8655
#>  max_abs_studentized prop_abs_studentized_gt2 prop_abs_studentized_gt3
#>                2.861                  0.05263                        0
#> 
#> Normality (whitened residuals):                   test n_tested statistic p_value
#>  shapiro_wilk_whitened       19    0.9312  0.1821
#> 
#> Heteroscedasticity trend (|raw residual| ~ fitted):   n corr_abs_raw_fitted  slope p_value
#>  19              0.3177 0.5347  0.1851