Learn R Programming

metafor (version 1.9-8)

update.rma: Model Updating for 'rma' Objects

Description

The function is 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

"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.

Value

If evaluate=TRUE the fitted object, otherwise the updated 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’).

References

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

See Also

rma.uni, rma.mh, rma.peto, rma.glmm, rma.mv

Examples

Run this code
### load BCG vaccine data
data(dat.bcg)

### calculate log relative risks 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")

Run the code above in your browser using DataLab