brmcoda | R Documentation |
Fit a brm
model with multilevel ILR coordinates
brmcoda(complr, formula, ...)
complr |
A |
formula |
A object of class |
... |
Further arguments passed to |
A brmcoda
with two elements
complr |
An object of class |
model |
An object of class |
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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.