# NOT RUN {
## fit a model
fit <- brm(time | cens(censored) ~ age + sex + (1 + age || patient),
data = kidney, family = "exponential", inits = "0")
## predicted responses
pp <- predict(fit)
head(pp)
## predicted responses excluding the group-level effect of age
pp <- predict(fit, re_formula = ~ (1 | patient))
head(pp)
## predicted responses of patient 1 for new data
newdata <- data.frame(
sex = factor(c("male", "female")),
age = c(20, 50),
patient = c(1, 1)
)
predict(fit, newdata = newdata)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab