Learn R Programming

brms (version 1.1.0)

update.brmsfit: Update brms models

Description

This method allows to update an existing brmsfit object

Usage

"update"(object, formula., newdata = NULL, ...)

Arguments

object
object of class brmsfit
formula.
changes to the formula; for details see update.formula
newdata
optional data.frame to update the model with new data
...
other arguments passed to brm

Details

Sometimes, when updating the model formula, it may happen that R complains about a mismatch between model frame and formula. This error can be avoided by supplying your orginal data again via argument newdata.

Examples

Run this code
## Not run: 
# fit1 <- brm(time | cens(censored) ~ age * sex + disease + (1|patient), 
#             data = kidney, family = gaussian("log"))
# summary(fit1)
# 
# ## remove effects of 'disease'
# fit2 <- update(fit1, formula. = ~ . - disease)
# summary(fit2)
# 
# ## remove the group specific term of 'patient' and
# ## change the data (just take a subset in this example)
# fit3 <- update(fit1, formula. = ~ . - (1|patient), 
#                newdata = kidney[1:38, ])
# summary(fit3)
# 
# ## use another family and add fixed effects priors
# fit4 <- update(fit1, family = weibull(), inits = "0",
#                prior = set_prior("normal(0,5)"))
# summary(fit4)
# ## End(Not run)

Run the code above in your browser using DataLab