Skip to contents

Convenience wrapper around mars_rf() for multivariate correlation or SMD inputs.

Usage

mars_rf_multivariate(
  data,
  studyID,
  effectID = NULL,
  sample_size = NULL,
  effectsize_type,
  variable_names = NULL,
  effectsize_name = NULL,
  varcov_type,
  intercept = FALSE,
  missing = "remove",
  multivariate_covs = NULL,
  num_trees = 500L,
  mtry = NULL,
  minsplit = 10L,
  minbucket = 5L,
  cp = 0.001,
  maxdepth = 30L,
  sample_fraction = 1,
  seed = NULL,
  importance = TRUE,
  weighting = c("sampling", "uniform", "random"),
  selection = c("node", "tree"),
  min_studies = 2L,
  prediction_scale = c("fisher_z", "raw"),
  ...
)

Arguments

data

Data used for analysis.

studyID

Character string representing the study ID.

effectID

Effect ID column for long-form SMD inputs. Correlation inputs generate canonical pair identities from variable_names and expose them as numID.

sample_size

Character string representing study sample size.

effectsize_type

Type of effect size being analyzed, such as "cor" or "smd".

variable_names

Vector of variables used for correlation synthesis in multivariate models.

effectsize_name

Character string naming the effect size column.

varcov_type

Type of within-study sampling covariance. Correlation forests require raw-correlation simple, weighted, or average covariance (including their cor_ aliases). Sampling covariance must be positive definite; invalid variances are rejected.

intercept

Coding option for the stored multivariate design matrix. Terminal prediction models always include a baseline.

missing

Missing-data handling mode. Use "remove", "keep", or "em". EM completes continuous missing moderators, using one record per study when moderators are study-level invariant. Within-study variation with missingness requires external multilevel imputation. EM completion does not propagate imputation uncertainty, and disables OOB evaluation. With keep, missing predictors follow a direction learned at each split; all observations contribute to split loss. Terminal linear models fill missing predictors using their training-leaf median or modal level.

multivariate_covs

One-sided formula specifying moderator covariates for multivariate models.

num_trees

Number of trees in the forest.

mtry

Number of candidate moderators selected at each node (default) or once per tree. Defaults to max(1, floor(sqrt(p))) for p moderators, or zero for multivariate models without moderators. Effect identity is retained separately and does not consume this budget. Explicit interaction columns count as predictors.

minsplit, minbucket

Tree-growing control parameters.

cp

Nonnegative fraction of the root weighted squared error required for a split. The same absolute penalty is used for cost-complexity pruning.

maxdepth

Maximum tree depth.

sample_fraction

Fraction of studies sampled with replacement for each tree.

seed

Optional random seed; the caller's RNG state is restored afterward.

importance

Logical; if TRUE, aggregate split-based variable importance across trees.

weighting

Split-loss weights: "sampling" (default) uses inverse sampling variances; "uniform" weights each observation equally; "random" is univariate-only and uses inverse sampling variance plus a nonnegative profiled ML intercept-model heterogeneity estimate, fitted separately to each in-bag sample. A sample with fewer than two distinct studies uses sampling weights and records an unavailable weight_tau. Terminal covariance fits retain the specified sampling covariance regardless of split weighting.

selection

"node" selects candidates at each split; "tree" selects a subset once for the entire tree. Terminal linear models use all available tree predictors, so node selection also yields a model-tree ensemble.

min_studies

Minimum distinct original resampling groups in each child node and for leaf variance estimation (which also requires at least two). Bootstrap copies do not count as additional independent groups.

prediction_scale

Correlation-only fitting scale: "fisher_z" (default) fits atanh(r), using the delta covariance J S J', with diagonal J = 1/(1-r^2), and returns tanh(fitted z). This is a back-transformed location, not an integrated raw-scale random-effects expectation. "raw" fits r directly and can extrapolate beyond [-1,1].

...

Additional arguments are rejected.

Examples

# \donttest{
rf_fit <- mars_rf_multivariate(
  data = becker09,
  studyID = "ID",
  effectID = "numID",
  sample_size = "N",
  effectsize_type = "cor",
  varcov_type = "weighted",
  variable_names = c(
    "Cognitive_Performance",
    "Somatic_Performance",
    "Selfconfidence_Performance",
    "Somatic_Cognitive",
    "Selfconfidence_Cognitive",
    "Selfconfidence_Somatic"
  ),
  multivariate_covs = ~ Team,
  num_trees = 25,
  seed = 123
)
rf_importance(rf_fit)
#>   predictor importance
#> 1 effect_id 0.98263881
#> 2      Team 0.01736119
# }