update.rma {metafor} | R Documentation |
Model Updating for 'rma' Objects
Description
Function to update and (by default) refit "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 |
formula. |
changes to the formula. See ‘Details’. |
... |
additional arguments to the call, or arguments with changed values. |
evaluate |
logical to specify 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://doi.org/10.18637/jss.v036.i03
See Also
rma.uni
, rma.mh
, rma.peto
, rma.glmm
, and rma.mv
for functions to fit models which can be updated / refit.
Examples
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
### fit random-effects model (method="REML" is default)
res <- rma(yi, vi, data=dat, digits=3)
res
### fit 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
### fit conditional model with approximate likelihood
update(res, model="CM.AL")