leave_one_out: Leave-One-Out Analysis for Meta-Analytic Models

View source: R/leave_one_out.R

leave_one_outR Documentation

Leave-One-Out Analysis for Meta-Analytic Models

Description

Performs a leave-one-out analysis on a meta-analytic model from the **metafor** package by iteratively removing each level of a grouping variable and refitting the model.

Usage

leave_one_out(
  model,
  group,
  vcalc_args = NULL,
  robust_args = NULL,
  phylo_args = NULL
)

Arguments

model

A meta-analytic model fitted using **metafor** package functions such as rma.mv().

group

A character string specifying the column name in model$data that contains the grouping variable for which levels will be iteratively removed.

vcalc_args

Optional list of arguments for variance-covariance calculation using metafor's vcalc function. Must include:

  • vi: Name of the variance column

  • cluster: Name of the clustering variable column

  • obs: Name of the observation ID column

  • rho: Correlation coefficient between effect sizes

robust_args

Optional list of arguments for robust variance estimation using metafor's robust function. Must include:

  • cluster: Name of the clustering variable column

  • clubSandwich: Logical indicating whether to use clubSandwich method (optional)

phylo_args

Optional list of arguments for phylogenetic matrix calculation using ape's vcv function. Must include:

  • tree: A phylogenetic tree object of class "phylo"

  • species_colname: Name of the column in model data linked to the tree tips

Value

An object of class "orchard" containing:

  • mod_table: A data frame with model estimates from each leave-one-out iteration, with an additional column indicating which group was omitted.

  • data: A data frame with effect sizes from each iteration, with an additional column indicating which group was omitted.

  • orig_mod_results: The results from the original model without any omissions, as returned by mod_results().

Author(s)

Facundo Decunta - fdecunta@agro.uba.ar

Examples

## Not run: 
res <- metafor::rma.mv(lnrr, lnrr_vi, random = ~ 1 | paper_ID, data = fish)
loo_results <- leave_one_out(res, group = "paper_ID")

# With variance-covariance calculation
loo_results <- leave_one_out(res, group = "paper_ID", 
                             vcalc_args = list(vi = "lnrr_vi", 
                                              cluster = "paper_ID", 
                                              obs = "es_ID", 
                                              rho = 0.5))
                                              
# With robust variance estimation
loo_results <- leave_one_out(res, group = "paper_ID", 
                             robust_args = list(cluster = "paper_ID"))

## End(Not run)


daniel1noble/orchaRd documentation built on April 17, 2025, 3:59 a.m.