Skip to contents

Fits a methodology-only baseline and a joint meta-regression of the original outcome on methodology and substantive moderators. Substantive associations are estimated in the joint model, conditional on all included predictors.

Usage

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,
  robust_args = list(),
  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",
  interactions = NULL,
  outcome = NULL,
  measure = NULL,
  units = NULL,
  sampling_covariance = NULL,
  ...
)

# S3 method for class 'masmr'
summary(object, fit_measures = TRUE, ...)

# S3 method for class 'summary.masmr'
print(x, ...)

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

The non-formula workflow supports "smd". For other measures use formula or outcome-aware precomputed inputs.

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 mode: "remove", "keep", or "em". EM completes continuous source predictors once across both moderator blocks (and scale predictors), then uses that same completed data in both models. Interactions and transformations are rebuilt afterward. Standard errors condition on the single completion; imputation uncertainty is not propagated. See Details for restrictions and diagnostics.

optim_method

Optimization method passed to mars.

robustID

Optional robust clustering ID passed to mars.

robust_args

Named list of robust covariance and inference controls passed to both MARS stages.

lasso

Must be FALSE; penalized inference is not supported.

lasso_args

Unused because LASSO is not supported in MASMR.

tol

Optimization tolerance passed to mars.

adjusted_effect_name

Unused; MASMR fits the original outcome jointly. Supplying this argument produces a warning.

interactions

Optional explicit substantive-by-methodology interaction terms, for example "weeks:tester". These belong only to the joint model.

outcome

Optional column naming outcomes for outcome-aware multivariate fits. Uses outcome-specific intercepts and moderator coefficients.

measure

Analysis measure code, or a named code per outcome. OR, RR and HR denote already log-transformed estimates; ZCOR denotes Fisher z. No transformation is automatic. See masmr_sensitivity().

units

Optional units, named per outcome; required for MD.

sampling_covariance

Positive-definite sampling covariance in original input row order. Mutually exclusive with weights; heterogeneity is separate.

...

Additional arguments passed to printing methods for the stage summaries.

object

An object of class "masmr".

fit_measures

Logical; if TRUE, request fit measures from stage summaries when available.

x

An object of class "summary.masmr".

Value

An object of class "masmr" containing:

baseline, joint

Methodology-only and joint fitted MARS models.

stage1, stage2

Additional names for baseline and joint.

analysis_data

Original-outcome analysis data shared by both models.

missing_data

Missing-data method and EM diagnostics, including original and completed predictors and the missingness mask in original input order. With EM, both fitted models carry the same diagnostics.

substantive_coefficients

Joint substantive coefficients with model-based normal 95 percent intervals and two-sided p-values.

substantive_test

Joint model-based Wald chi-square test of all substantive design columns, conditional on methodology.

workflow

One of "formula", "multivariate", or "smd".

Details

Use masmr_contrast() to compare substantive scenarios under an explicit methodological profile or shared distribution. Target weights define the estimand and are distinct from fitting weights. masmr_support() reports support diagnostics. Existing coefficient summaries retain model-based normal inference; contrast inference is selected explicitly in the contrast call. Both models use the original outcome and sampling covariance; no stage-1 residuals are refitted. The moderator lists define the fixed predictors; formula supplies the outcome, intercept convention and random terms. Terms may not overlap between lists. The substantive table and test use model-based covariance, not robust covariance. Robust results, when requested, remain available in the joint fit. Inference is asymptotic and inherits the assumptions of MARS. Use ML, not REML likelihood comparisons, when comparing different fixed predictor sets. EM uses the shared MARS multivariate-normal completion helper once before fitting. Missing predictors must be continuous; incomplete categorical predictors are rejected. Repeated studies require study-level invariant predictors. Missing outcomes and variances are not imputed. Complete scale predictors and moderator variables condition the completion; outcome values and additional auxiliary variables are not automatically included. Completed source predictors are held fixed during sensitivity refits. Support diagnostics describe completed-data geometry, not purely observed support. EM convergence does not establish the missingness assumptions or account for imputation uncertainty. Use external proper multiple imputation and appropriate pooling for uncertainty-aware missing-data inference. LASSO is not supported. SMD user weights and transformed calls inside random terms are rejected explicitly. Create transformed random-slope columns in the data before fitting.

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) 
#> 
#> Baseline (Methodology Only)
#> Results generated with MARS:v 0.6.0.8 
#> Thursday, November  5, 2026
#> 
#> Model Type: 
#> univariate
#> 
#> Estimation Method: 
#> Restricted Maximum Likelihood
#> 
#> Coefficient covariance: gls
#> Optimizer convergence code: 0
#> 
#> 
#> Model Formula: 
#> yi ~ 1 + factor(tester)
#> <environment: 0x653fddd02148>
#> 
#> 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): 47.52336
#> 
#> Residual Diagnostics:
#>  Diagnostic                            Value  
#>  Observations                          19     
#>  Finite raw residuals                  19     
#>  Mean raw residual                     0.06879
#>  SD of raw residuals                   0.3547 
#>  Root mean squared residual            0.352  
#>  Mean absolute residual                0.2418 
#>  Sum of squared Pearson residuals      22.86  
#>  Mean |studentized residual|           0.907  
#>  Maximum |studentized residual|        2.846  
#>  Proportion |studentized residual| > 2 0.1053 
#>  Proportion |studentized residual| > 3 0      
#> 
#> Normality screen (Shapiro-Wilk, whitened residuals):
#>   N      W p-value
#>  19 0.9141 0.08801
#> 
#> Heteroscedasticity screen (|raw residual| vs fitted):
#>   N Correlation   Slope p-value
#>  19     -0.1174 -0.5868  0.6322
#> 
#> Joint Model (Methodology and Substantive Predictors)
#> Results generated with MARS:v 0.6.0.8 
#> Thursday, November  5, 2026
#> 
#> Model Type: 
#> univariate
#> 
#> Estimation Method: 
#> Restricted Maximum Likelihood
#> 
#> Coefficient covariance: gls
#> Optimizer convergence code: 0
#> 
#> 
#> Model Formula: 
#> yi ~ 1 + factor(tester) + year + weeks + factor(setting)
#> <environment: 0x653fddd02148>
#> 
#> Data Summary: 
#> Number of Effect Sizes: 19
#> Number of Fixed Effects: 5
#> Number of Random Effects: 1
#> 
#> Random Components: 
#>       term     var     SD
#>  intercept 0.01109 0.1053
#> 
#> Fixed Effects Estimates: 
#>    attribute  estimate        SE   z_test p_value     lower      upper
#>  (Intercept) 35.888447 51.292888  0.69968  0.4841 -64.64377 136.420660
#>        blind  0.001689  0.101523  0.01664  0.9867  -0.19729   0.200670
#>         year -0.018133  0.026036 -0.69645  0.4861  -0.06916   0.032897
#>        weeks -0.014011  0.005933 -2.36151  0.0182  -0.02564  -0.002382
#>        indiv  0.226317  0.190726  1.18661  0.2354  -0.14750   0.600132
#> 
#> Model Fit Statistics: 
#>  logLik   Dev AIC   BIC AICc
#>  -1.499 2.998  15 18.83 87.8
#> 
#> Q Error: 24.227 (14), p = 0.043
#> 
#> I2 (General): 27.96069
#> 
#> Residual Diagnostics:
#>  Diagnostic                            Value  
#>  Observations                          19     
#>  Finite raw residuals                  19     
#>  Mean raw residual                     0.05269
#>  SD of raw residuals                   0.3123 
#>  Root mean squared residual            0.3085 
#>  Mean absolute residual                0.2049 
#>  Sum of squared Pearson residuals      19.12  
#>  Mean |studentized residual|           0.9164 
#>  Maximum |studentized residual|        2.794  
#>  Proportion |studentized residual| > 2 0.05263
#>  Proportion |studentized residual| > 3 0      
#> 
#> Normality screen (Shapiro-Wilk, whitened residuals):
#>   N      W p-value
#>  19 0.9416  0.2817
#> 
#> Heteroscedasticity screen (|raw residual| vs fitted):
#>   N Correlation Slope p-value
#>  19      0.2794 0.398  0.2467
#> 
#> Substantive associations (model-based 95% intervals)
#>                  term    estimate   std_error    conf_low    conf_high
#>                  year -0.01813305 0.026036384 -0.06916343  0.032897323
#>                 weeks -0.01401058 0.005932892 -0.02563883 -0.002382321
#>  factor(setting)indiv  0.22631690 0.190725607 -0.14749842  0.600132217
#>     p_value
#>  0.48614676
#>  0.01820075
#>  0.23538152
#> $statistic
#> [1] 8.784025
#> 
#> $df
#> [1] 3
#> 
#> $p_value
#> [1] 0.03230458
#> 
#> $method
#> [1] "Model-based joint Wald chi-square test of substantive coefficients"
#>