plot_between_study_sd: Plot between-study standard deviation

View source: R/plot_between_study_sd.R

plot_between_study_sdR Documentation

Plot between-study standard deviation

Description

When a random effects meta analysis has been used, this function visualizes how the between-study standard deviation depends on the explanatory variable.

Usage

plot_between_study_sd(x)

Arguments

x

Object returned from metagam.

Value

A ggplot object.

Examples

library("mgcv")
set.seed(1233)
shifts <- c(0, .5, 1, 0, -1)
datasets <- lapply(shifts, function(x) {
  ## Simulate data
  dat <- gamSim(scale = .1, verbose = FALSE)
  ## Add a shift
  dat$y <- dat$y + x * dat$x2^2
  ## Return data
  dat
})

models <- lapply(datasets, function(dat){
  b <- gam(y ~ s(x2, bs = "cr"), data = dat)
  strip_rawdata(b)
})

meta_analysis <- metagam(models, method = "REML")

plot_between_study_sd(meta_analysis)



metagam documentation built on May 31, 2023, 6:43 p.m.