Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

update.rma

Model Updating for 'rma' Objects


Description

The function can be used to update and (by default) re-fit "rma" models. It does this by extracting the call stored in the object, updating the call and (by default) evaluating that call.

Usage

## S3 method for class 'rma'
update(object, formula., ..., evaluate = TRUE)

Arguments

object

an object of class "rma".

formula.

changes to the formula. See ‘Details’.

...

additional arguments to the call, or arguments with changed values.

evaluate

logical indicating whether to evaluate the new call or just return the call.

Details

For objects of class "rma.uni", "rma.glmm", and "rma.mv", the formula. argument can be used to update the set of moderators included in the model (see ‘Examples’).

Value

If evaluate=TRUE the fitted object, otherwise the updated call.

Author(s)

The present function is based on update.default, with changes made by Wolfgang Viechtbauer (wvb@metafor-project.org) so that the formula updating works with the (somewhat non-standard) interface of the rma.uni, rma.glmm, and rma.mv functions.

References

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

See Also

Examples

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

### random-effects model (method="REML" is default)
res <- rma(yi, vi, data=dat, digits=3)
res

### mixed-effects model with two moderators (absolute latitude and publication year)
res <- update(res, ~ ablat + year)
res

### remove 'year' moderator
res <- update(res, ~ . - year)
res

### fit model with ML estimation
update(res, method="ML")

### example with rma.glmm()
res <- rma.glmm(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, digits=3)
res <- update(res, mods = ~ ablat)
res

### conditional model with approximate likelihood
update(res, model="CM.AL")

metafor

Meta-Analysis Package for R

v2.4-0
GPL (>= 2)
Authors
Wolfgang Viechtbauer [aut, cre] (<https://orcid.org/0000-0003-3463-4063>)
Initial release
2020-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.