Learn R Programming

orchaRd (version 2.2.1)

leave_one_out: 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
)

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().

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

Author

Facundo Decunta - fdecunta@agro.uba.ar

Examples

Run this code
# \donttest{
# Subset to a few studies so the leave-one-out refits run quickly
fish_sub <- fish[fish$paper_ID %in% unique(fish$paper_ID)[1:5], ]
res <- metafor::rma.mv(lnrr, lnrr_vi, random = ~ 1 | paper_ID, data = fish_sub)
loo_results <- leave_one_out(res, group = "paper_ID")

# With robust variance estimation
loo_robust <- leave_one_out(res, group = "paper_ID",
                            robust_args = list(cluster = "paper_ID"))
# }

Run the code above in your browser using DataLab