insight icon indicating copy to clipboard operation
insight copied to clipboard

n_obs(..., disaggregate = TRUE) for brms models with `trials()` or `weights()`

Open bwiernik opened this issue 3 years ago • 0 comments
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)

bwiernik avatar Jun 09 '22 18:06 bwiernik