formula.rma: Extract the Model Formula from 'rma' Objects

View source: R/formula.rma.r

formula.rmaR Documentation

Extract the Model Formula from 'rma' Objects

Description

Function to extract the model formula from objects of class "rma".

Usage

## S3 method for class 'rma'
formula(x, type="mods", ...)

Arguments

x

an object of class "rma".

type

the formula which should be returned; either "mods" (default), "yi" (in case argument yi was used to specify a formula), or "scale" (only for location-scale models).

...

other arguments.

Value

The requested formula.

Author(s)

Wolfgang Viechtbauer wvb@metafor-project.org https://www.metafor-project.org

References

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. ⁠https://doi.org/10.18637/jss.v036.i03⁠

See Also

rma.uni, rma.glmm, and rma.mv for functions to fit models for which a model formula can be extracted.

Examples

### copy BCG vaccine data into 'dat'
dat <- dat.bcg

### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat,
              slab=paste(author, ", ", year, sep=""))

### mixed-effects meta-regression model
res <- rma(yi, vi, mods = ~ ablat + alloc, data=dat)
formula(res, type="mods")

### specify moderators via 'yi' argument
res <- rma(yi ~ ablat + alloc, vi, data=dat)
formula(res, type="yi")

metafor documentation built on May 29, 2024, 7:44 a.m.