I’m relatively new to brms. I’m dealing with one of the studies by my student.
Question: The experiment has different conditions (treatment vs control), type (four levels of exposure in sequence; the four levels are counter-balanced across subjects), and phase (baseline, experiment, post experiment). I have count data (number of vocalizations) as response variable. I’m using negative binomial distribution as family as the response data has 0s and also very high values (like 250). Here’s the prior and model
priors_fit <- c(
prior(normal(1, 1), class = Intercept),
prior(normal(0, 1), class = b),
prior(exponential(2), class = sd),
prior(gamma(4, 0.1), class = shape)
)
model_fit <- brm(
formula = vocal ~ condition * type * phase + sex + (1 + phase | ID),
data = w_data,
family = negbinomial(),
prior = priors_fit,
chains = 4,
iter = 4000,
cores = 4,
file = "model_fit"
)
- Is this model structure correct?
- Though I could extracted how population and group level parameters vary in different conditions, types or phase, I’m more interested in comparing the variance or standard deviation across types. I have looked at this Estimating Distributional Models with brms but I’m not sure how to do it for negative binomial distribution. I tried doing similar but the models didn’t converge. Here’s one of the model
variance_model <- brm(
bf(vocal ~ condition * type * phase + sex + (1 + phase | ID),
shape ~ type),
family = negbinomial(),
data = w_data,
prior = c(
prior(normal(1, 1), class = Intercept),
prior(normal(0, 1), class = b),
prior(exponential(2), class = sd),
prior(gamma(4, 0.1), class = "b", dpar = "shape",lb = 0)
),
control = list(adapt_delta = 0.95),
cores = 4,
chains = 4,
iter = 4000
)
I think, I’m doing something wrong. Maybe the priors are not correct for negative binomial or the fit. Ideally what I want is, comment something like: the variance of response across four levels of types are different (or similar) and which two levels are similar or different.
The idea is that each level of exposure in type can produce different variance of response because of uncertainty perceived by the subjects.
Can someone also guide me to some resources that deal with similar kind of problems? And the interpretation of the output for the model?
Thank you!