get_data_raw: get_data_raw

View source: R/mod_results.R

get_data_rawR Documentation

get_data_raw

Description

Collects and builds the data used to fit the rma.mv or rma model in metafor.

Usage

get_data_raw(model, mod, group, N = NULL, at = NULL, subset = TRUE)

Arguments

model

rma.mv object.

mod

the moderator variable.

group

The grouping variable that one wishes to plot beside total effect sizes, k. This could be study, species, or whatever other grouping variable one wishes to present sample sizes.

N

The name of the column in the data specifying the sample size, N. Defaults to NULL, so precision is plotted instead of sample size.

at

List of moderators. If at is equal to mod then levels specified within at will be used to subset levels when subset = TRUE. Otherwise, it will marginalise over the moderators at the specified levels.

subset

Whether or not to subset levels within the mod argument. Defaults to FALSE.

Value

Returns a data frame

Author(s)

Shinichi Nakagawa - s.nakagawa@unsw.edu.au

Daniel Noble - daniel.noble@anu.edu.au

Examples

## Not run: 
data(fish)
warm_dat <- fish
model <- metafor::rma.mv(yi = lnrr, V = lnrr_vi, random = list(~1 | group_ID, ~1 | es_ID), mods = ~ experimental_design + trait.type + deg_dif + treat_end_days, method = "REML", test = "t", data = warm_dat, control=list(optimizer="optim", optmethod="Nelder-Mead"))
 test <- get_data_raw(model, mod = "trait.type", group = "group_ID", at = list(trait.type = c("physiology", "morphology")))
 test2 <- get_data_raw(model, mod = "1", group = "group_ID")

 data(english)
 # We need to calculate the effect sizes, in this case d
 english <- escalc(measure = "SMD", n1i = NStartControl, sd1i = SD_C, m1i = MeanC, n2i = NStartExpt, sd2i = SD_E, m2i = MeanE, var.names=c("SMD","vSMD"))
 model <- rma.mv(yi = SMD, V = vSMD, random = list( ~ 1 | StudyNo, ~ 1 | EffectID), data = english)
 test3 <-  get_data_raw(model, mod = "1", group = "StudyNo")
## End(Not run)

daniel1noble/orchaRd documentation built on May 12, 2024, 7:46 a.m.