update.rma | R Documentation |
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.
## S3 method for class 'rma'
update(object, formula., ..., evaluate=TRUE)
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. |
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’).
If evaluate=TRUE
the fitted object, otherwise the updated call.
Based on update.default
, with changes made by Wolfgang Viechtbauer (wvb@metafor-project.org, https://www.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.
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
rma.uni
, rma.mh
, rma.peto
, rma.glmm
, and rma.mv
for functions to fit models which can be updated / refit.
### 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.