
Mixed Correlation Matrix for Meta-Analytic Path Modeling
mixed_corr_meta.RdCompute a mixed-type correlation matrix for an effect-size outcome and
moderator variables, using inverse-variance weights for pairs involving
the outcome and unweighted correlations for moderator-moderator pairs.
The function also bootstraps the variance-covariance matrix of the pooled
correlations and returns a mars-compatible object for path_model.
Usage
mixed_corr_meta(
data,
outcome = "yi",
variance = "vi",
moderators,
variable_types = NULL,
bootstrap = 1000,
seed = NULL,
use_fisher_z = TRUE,
min_non_missing = 4
)Arguments
- data
A data frame containing the outcome, variance, and moderator columns.
- outcome
Name of the effect-size column (for example,
"yi").- variance
Name of the sampling-variance column used to define inverse-variance weights (for example,
"vi").- moderators
Character vector of moderator variable names.
- variable_types
Optional named character vector with values in
c("continuous","binary","ordinal"). WhenNULL, types are inferred from the columns.- bootstrap
Number of bootstrap resamples for estimating the variance-covariance matrix.
- seed
Optional random seed for reproducibility.
- use_fisher_z
Logical; if
TRUE, bootstrap covariance is computed on Fisher-z scale and transformed back to the correlation scale.- min_non_missing
Minimum non-missing pairwise observations required to compute a correlation.
Value
A list with class "mars_corr":
- corr_matrix
Pooled correlation matrix.
- varcov_matrix
Bootstrap variance-covariance matrix of pooled correlations in
corpcor::sm2vec(corr_matrix)order.- method_matrix
Matrix recording the method used for each pair.
- pair_details
Data frame with pair, estimate, weighting, and method details.
- mars_object
A compact object directly consumable by path_model.
Examples
out <- mixed_corr_meta(
data = teacher_expectancy,
outcome = "yi",
variance = "vi",
moderators = c("year", "weeks", "setting", "tester"),
bootstrap = 50,
seed = 123
)
model <- "yi ~ year + weeks + setting + tester"
fit <- path_model(out, model = model, adjust_se = TRUE)