insight
insight copied to clipboard
n_obs(..., disaggregate = TRUE) for brms models with `trials()` or `weights()`
trafficstars
For binomial and multinomial trials with a | trials() or | weights() argument, there should be an option to get disaggregate the data and return the total number of trials, like we do with 'glm' models.
library(brms)
m <- brm(incidence | trials(size) ~ period, data = lme4::cbpp, family = "binomial")
n_obs(m)
n_obs(m, disaggregate = TRUE)