This method allows for updating an existing brmcoda
object.
Usage
# S3 method for class 'brmcoda'
update(object, formula. = NULL, newdata = NULL, newcomplr = NULL, ...)
Arguments
- object
A fitted
brmcoda
object to be updated.- formula.
Changes to the formula; for details see
update.formula
andbrmsformula
.- newdata
A
data.frame
ordata.table
containing data of all variables used in the analysis. It must include a composition and the same ID variable as the existingcomplr
object.- newcomplr
A
complr
object containing data of composition, ILR coordinates, and other variables used in the updated model.- ...
Further arguments passed to
brm
.
Value
A brmcoda
with two elements
complr
An object of class
complr
used in thebrm
model.model
An object of class
brmsfit
, which contains the posterior draws along with many other useful information about the model.
Examples
# \donttest{
if(requireNamespace("cmdstanr")){
# model with compositional predictor at between and within-person levels
fit <- brmcoda(complr = complr(data = mcompd, sbp = sbp,
parts = c("TST", "WAKE", "MVPA", "LPA", "SB"),
idvar = "ID"),
formula = Stress ~ bilr1 + bilr2 + bilr3 + bilr4 +
wilr1 + wilr2 + wilr3 + wilr4 + (1 | ID),
chain = 1, iter = 500,
backend = "cmdstanr")
# removing the effect of wilr1
fit1 <- update(fit, formula. = ~ . - wilr1)
# using only a subset
fit2 <- update(fit, newdata = mcompd[ID != 1])
}# }
#> Error: CmdStan path has not been set yet. See ?set_cmdstan_path.