Mixed-Correlation-Path-Workflow.RmdThis vignette shows how to:
library(mars)
teacher_expectancy
#> study author year weeks setting tester n1i n2i yi vi
#> 1 1 Rosenthal et al. 1974 2 group aware 77 339 0.03 0.0156
#> 2 2 Conn et al. 1968 21 group aware 60 198 0.12 0.0216
#> 3 3 Jose & Cody 1971 19 group aware 72 72 -0.14 0.0279
#> 4 4 Pellegrini & Hicks 1972 0 group aware 11 22 1.18 0.1391
#> 5 5 Pellegrini & Hicks 1972 0 group blind 11 22 0.26 0.1362
#> 6 6 Evans & Rosenthal 1969 3 group aware 129 348 -0.06 0.0106
#> 7 7 Fielder et al. 1971 17 group blind 110 636 -0.02 0.0106
#> 8 8 Claiborn 1969 24 group aware 26 99 -0.32 0.0484
#> 9 9 Kester 1969 0 group aware 75 74 0.27 0.0269
#> 10 10 Maxwell 1970 1 indiv blind 32 32 0.80 0.0630
#> 11 11 Carter 1970 0 group blind 22 22 0.54 0.0912
#> 12 12 Flowers 1966 0 group blind 43 38 0.18 0.0497
#> 13 13 Keshock 1970 1 indiv blind 24 24 -0.02 0.0835
#> 14 14 Henrikson 1970 2 indiv blind 19 32 0.23 0.0841
#> 15 15 Fine 1972 17 group aware 80 79 -0.18 0.0253
#> 16 16 Grieger 1970 5 group blind 72 72 -0.06 0.0279
#> 17 17 Rosenthal & Jacobson 1968 1 group aware 65 255 0.30 0.0193
#> 18 18 Fleming & Anttonen 1971 2 group blind 233 224 0.07 0.0088
#> 19 19 Ginsburg 1970 7 group aware 65 67 -0.07 0.0303In this example:
yi is a standardized mean difference effect size.vi is the sampling variance for yi.year, weeks, setting, and
tester are moderators.
mixed_out <- mixed_corr_meta(
data = teacher_expectancy,
outcome = "yi",
variance = "vi",
moderators = c("year", "weeks", "setting", "tester"),
bootstrap = 500,
seed = 123
)
mixed_out$corr_matrix
#> yi year weeks setting tester
#> yi 1.0000000 -0.17377760 -0.47712494 0.34841126 0.13698579
#> year -0.1737776 1.00000000 -0.01417866 -0.02613542 -0.05725983
#> weeks -0.4771249 -0.01417866 1.00000000 -0.26939576 -0.38397996
#> setting 0.3484113 -0.02613542 -0.26939576 1.00000000 0.45643546
#> tester 0.1369858 -0.05725983 -0.38397996 0.45643546 1.00000000
mixed_out$method_matrix
#> yi year weeks
#> yi "diag" "weighted_pearson" "weighted_pearson"
#> year "weighted_pearson" "diag" "pearson"
#> weeks "weighted_pearson" "pearson" "diag"
#> setting "weighted_point_biserial" "point_biserial" "point_biserial"
#> tester "weighted_point_biserial" "point_biserial" "point_biserial"
#> setting tester
#> yi "weighted_point_biserial" "weighted_point_biserial"
#> year "point_biserial" "point_biserial"
#> weeks "point_biserial" "point_biserial"
#> setting "diag" "phi_fallback"
#> tester "phi_fallback" "diag"
head(mixed_out$pair_details)
#> var1 var2 estimate method weighted n_used
#> 1 yi year -0.17377760 weighted_pearson TRUE 19
#> 2 yi weeks -0.47712494 weighted_pearson TRUE 19
#> 3 yi setting 0.34841126 weighted_point_biserial TRUE 19
#> 4 yi tester 0.13698579 weighted_point_biserial TRUE 19
#> 5 year weeks -0.01417866 pearson FALSE 19
#> 6 year setting -0.02613542 point_biserial FALSE 19method_matrix reports the method used for each pair (for
example, weighted Pearson/point-biserial for pairs involving
yi, and tetrachoric or fallback methods for binary-binary
moderator pairs).
The output of mixed_corr_meta() can be passed directly
to path_model().
model <- "
yi ~ year + weeks + setting + tester
"
fit <- path_model(
mars_object = mixed_out,
model = model,
adjust_se = TRUE,
se_method = "bootstrap",
se_draws = 300,
se_seed = 123
)
summary(fit)
#> Results generated with MARS:v 0.5.1.1
#> Thursday, April 2, 2026
#>
#> Model Type:
#> multivariate
#>
#> Average Correlation Matrix:
#> yi year weeks setting tester
#> yi 1.0000000 -0.17377760 -0.47712494 0.34841126 0.13698579
#> year -0.1737776 1.00000000 -0.01417866 -0.02613542 -0.05725983
#> weeks -0.4771249 -0.01417866 1.00000000 -0.26939576 -0.38397996
#> setting 0.3484113 -0.02613542 -0.26939576 1.00000000 0.45643546
#> tester 0.1369858 -0.05725983 -0.38397996 0.45643546 1.00000000
#>
#> Synthesis options:
#> method: model
#> transform: none
#> missing_corr: available
#> attenuation: none
#> pd_adjust: none
#> pd_adjusted: FALSE
#> min eigen (before/after): 0.3451 / 0.3451
#> Fit note: Fit statistics that depend on sample size are unavailable for mixed-correlation path models unless `num_obs` is supplied explicitly.
#>
#>
#> Model Fitted:
#>
#> yi ~ year + weeks + setting + tester
#>
#>
#> Fixed Effects:
#> predictor outcome estimate standard_errors test_statistic
#> year -> yi year yi -0.1836078 0.1770477 -1.0370532
#> weeks -> yi weeks yi -0.4720558 0.2274376 -2.0755400
#> setting -> yi setting yi 0.3049891 0.2653360 1.1494451
#> tester -> yi tester yi -0.1939954 0.2230589 -0.8697048
#> p_value
#> year -> yi 0.29971108
#> weeks -> yi 0.03793652
#> setting -> yi 0.25037248
#> tester -> yi 0.38446174
#>
#>
#> Fit Statistics:
#> Type Value
#> 1 Model Chi-Square <NA>
#> 2 Null Model Chi-Square <NA>
#> 3 CFI <NA>
#> 4 TLI <NA>
#> 5 RMSEA <NA>
#> 6 SRMR <NA>
#> 7 CFI (raw) <NA>
#> 8 TLI (raw) <NA>mixed_out$varcov_matrix is used to propagate uncertainty
from the pooled correlation estimates into path-model standard
errors.
If you prefer a parametric alternative, use:
fit_sim <- path_model(
mars_object = mixed_out,
model = model,
adjust_se = TRUE,
se_method = "simulation",
se_draws = 1000,
se_seed = 123
)Fit indices are bounded to valid ranges for reporting
(CFI/TLI/SRMR in [0, 1]), while unbounded
values are retained in fit$fit_measures$fit_index_raw for
diagnostics.