Skip to contents

Compute correlations across rows of effect sizes and moderators, with consistently weighted observed-scale correlations by default. This estimates associations among study-level quantities; it does not pool participant-level correlation matrices reported by multiple studies.

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,
  correlation_scale = c("observed", "latent"),
  weighting = c("inverse_variance", "none", "outcome_only"),
  fallback = c("error", "observed"),
  cluster_id = NULL
)

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"). When NULL, 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.

correlation_scale

"observed" computes Pearson correlations on the supplied values or category scores. "latent" uses two-step Gaussian polyserial/polychoric correlations for categorical variables, including tetrachoric correlations for binary pairs.

weighting

"inverse_variance" applies 1 / variance to every pair; "none" uses equal weights; "outcome_only" weights only pairs involving the outcome and is a descriptive hybrid whose matrix may be indefinite.

fallback

"error" stops when a latent point estimate fails. "observed" explicitly permits a labelled observed-scale fallback.

cluster_id

Optional independent study/cluster column. Bootstrap sampling retains all rows within each sampled cluster. Without this argument, rows are assumed independent and are resampled individually.

Value

A list with class "mars_corr":

corr_matrix

Estimated study-level correlation matrix.

varcov_matrix

Bootstrap variance-covariance matrix of pooled correlations in column-major lower-triangle 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.

Details

Observed binary values are coded 0/1 in sorted level order; the continuous- binary correlation is point-biserial and the binary-binary correlation is phi. Ordinal variables use their ordered factor levels (or sorted supplied scores). Numeric-score correlations depend on that scoring choice. Unordered factors with more than two levels need an explicit scientifically justified type/order.

The observed weighted estimator divides the weighted centered cross-product by the product of weighted standard deviations. Pairwise complete rows are used. Common weights give a common target when observations are complete; differing missing-data patterns can still produce an indefinite matrix. effective_n is Kish's weight diagnostic, not inferential degrees of freedom.

Latent estimators assume underlying Gaussian variables and ordered thresholds. Weighted marginal category proportions determine thresholds. Polyserial fitting uses conditional category probabilities after weighted standardization of the continuous variable. Polychoric/tetrachoric fitting maximizes the weighted contingency-table likelihood using numerical bivariate-normal rectangle probabilities. The correlation search is restricted to (-.995,.995); boundary estimates are failures. Latent values describe underlying continuous variables and are not interchangeable with observed binary/ordinal correlations. Explicit fallback can change the estimand and must be inspected in method labels and bootstrap diagnostics. No optional correlation package is required.

Bootstrap draws recompute the selected estimators and weights jointly. Draws with a missing correlation are rejected; requested, accepted and rejected counts and the independent-unit count are retained. The estimated covariance is inspectable in varcov_matrix, but the downstream matched covariance is withheld unless at least 50 draws and 80 percent of requested draws succeed. With use_fisher_z=TRUE, covariance of transformed draws is back-transformed using a diagonal delta-method Jacobian; FALSE uses empirical raw-r covariance. Stored draws remain on the raw-r scale. A specified seed preserves the caller's RNG state. Large bootstrap counts reduce Monte Carlo error but do not create additional independent studies.

min_eigenvalue diagnoses matrix validity; no automatic matrix repair occurs. The adapter contains sampling covariance, not a between-study Tau estimate. path_model() can fit WLS with this matched covariance. Such a model describes associations among the study-level variables, not participant-level causal paths.

Examples

out <- mixed_corr_meta(
  data = teacher_expectancy,
  outcome = "yi",
  variance = "vi",
  moderators = c("year", "weeks"),
  bootstrap = 50,
  seed = 123
)

model <- "yi ~ year + weeks"
fit <- path_model(out, model = model, adjust_se = TRUE)