Skip to contents

Fit a meta-regression model with random effects using the metafor::rma.mv() function from the metafor::metafor package to a data.frame containing the estimates and variances for the meta-analysis.

Usage

fit_MA_mv(
  effects_analysis = data.frame(),
  outcome_colname,
  outcome_SE_colname,
  estimate_type = character(1L)
)

Arguments

effects_analysis

A dataframe containing the estimates and variances for the meta-analysis.

outcome_colname

The name of the column containing the estimates.

outcome_SE_colname

The name of the column containing the variances.

estimate_type

The type of estimate to be used in the model. One of c("Zr", "y50", "y25", "y75", or "yi").

Value

A fitted model of class c("rma.mv","rma").

Details

This function is a wrapper around the metafor::rma.mv() function from the metafor::metafor package. It takes a dataframe containing the estimates and variances for the meta-analysis, the name of the column containing the estimates, the name of the column containing the variances, and the type of estimate to be used in the model. It then fits a metaregression model with random-effects using the metafor::rma.mv() function called in fit_metafor_mv() and returns the fitted model.

Nested random effects are included for TeamIdentifier and TeamIdentifier/study_id.

Examples

ManyEcoEvo_results$effects_analysis[[1]] %>%
  fit_MA_mv(beta_estimate, beta_SE, "Zr")
#> 
#> ── Fitting metaregression ──
#> 
#> 
#> Multivariate Meta-Analysis Model (k = 131; method: REML)
#> 
#> Variance Components:
#> 
#>                estim     sqrt  nlvls  fixed                   factor 
#> sigma^2.1   979.7136  31.3004     63     no           TeamIdentifier 
#> sigma^2.2  6623.0949  81.3824    131     no  TeamIdentifier/study_id 
#> 
#> Test for Heterogeneity:
#> Q(df = 130) = 7544.9806, p-val < .0001
#> 
#> Model Results:
#> 
#> estimate      se     zval    pval     ci.lb   ci.ub    
#> -10.9500  8.4194  -1.3006  0.1934  -27.4517  5.5518    
#> 
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>