Hi,

I am having issues with extracting specific output from the brms function. I want to model how the probability of being in one of three categories changes with both age and sex of an individual. But the output from brms is either how it changes with age or how it differs based on sex and not a combination of the two. So my question is whether there is a way to get that from the model output?

I am working on a model with a categorical (multinomial) response that has three possible outcomes and a continuous and a categorical explanatory variable. I am modelling the continuous variable (age) as a spline to allow for a non-linear relationship and the continuous variable can change differently depending on the categorical variable (2 levels, males and females).

m1 ← brms(y ~ s(age by = sex, bs = “tp”) + s(sex, bs = “re”),

data = df,

family = categorical, …)

I have tried to model this with a binomial response instead and modelled three separate models for each of the categories of the response. For this model, I am able to get the output of how the response changes with both age and sex. But I would like to get it to work as a multinomial model instead.

Let me know if there is other information needed to understand the question!

Thank you,

Mia