brmcoda {multilevelcoda} | R Documentation |
Fit Bayesian generalised (non-)linear multilevel compositional model via full Bayesian inference
Description
Fit a brm
model with multilevel ILR coordinates
Usage
brmcoda(complr, formula, ...)
Arguments
complr |
A |
formula |
A object of class |
... |
Further arguments passed to |
Value
A brmcoda
with two elements
complr |
An object of class |
model |
An object of class |
Examples
if(requireNamespace("cmdstanr")){
cilr <- complr(data = mcompd, sbp = sbp,
parts = c("TST", "WAKE", "MVPA", "LPA", "SB"), idvar = "ID")
# inspects ILRs before passing to brmcoda
names(cilr$between_logratio)
names(cilr$within_logratio)
names(cilr$logratio)
# model with compositional predictor at between and within-person levels
m1 <- brmcoda(complr = cilr,
formula = Stress ~ bilr1 + bilr2 + bilr3 + bilr4 +
wilr1 + wilr2 + wilr3 + wilr4 + (1 | ID),
chain = 1, iter = 500,
backend = "cmdstanr")
# model with compositional outcome
m2 <- brmcoda(complr = cilr,
formula = mvbind(ilr1, ilr2, ilr3, ilr4) ~ Stress + Female + (1 | ID),
chain = 1, iter = 500,
backend = "cmdstanr")
}
[Package multilevelcoda version 1.3.0.2 Index]