zijun
July 1, 2023, 1:41pm
1
How can I create a multivariable Logistic regression model and use brms to make responses correlated?
For example, there are three alternatives for urban residents’ travel: car, bus, and subway. Therefore, I would like to use age, gender, and travel distance as independent variables, and region as grouping factor. How can I model these three alternatives as relevant?
the basic brms formular:
model= brm(choice ~ age+ gender+travel_distance+(1| region), data=data, family=‘categorical’)
I don’t know how to change this model to one with responses correlated.
Brms does have some capability in conditional logit models through the nlf syntax. See:
opened 04:38PM - 28 Nov 18 UTC
feature
family
Following up on https://twitter.com/paulbuerkner/status/1067809413581414401
… It would be great it BRMS could support conditional logit models. They are used in a lot of places, such as analyzing conjoint experiments, purchase decisions or voting behavior.
As an example let's suppose that consumers (i) enter a store and can choose one brand of cereal. Different stores have different inventory at different times so the choice set is not always the same. We'll say that consumers weigh up the nutrition, price and advertising that each brand has received when making their decision and we want to know what weights they put on each. The data might look something like:
![image](https://user-images.githubusercontent.com/11521792/49165928-54058e80-f300-11e8-8340-48d8c5db6b1c.png)
They're definitely possible in Stan in some form:
https://www.rdocumentation.org/packages/rstanarm/versions/2.17.4/topics/stan_clogit
Here's the original McFadden paper on the models:
https://eml.berkeley.edu/reprints/mcfadden/zarembka.pdf
I think the key extra piece of information that needs to be given is an identifier that defines one choice situation.
brm(formula = choice|chid(consumer) ~ price + nutrition + advertising)
we might then imagine that older people are more susceptible to advertising so we would interact age and advertising
brm(formula = choice|chid(consumer) ~ price + nutrition + advertising:age + advertising)
or that the slope of advertising varies across states:
brm(formula = choice|chid(consumer) ~ price + nutrition + advertising + (1+advertising|state), data)
I wonder if we could also have brand (i.e. particular choice) specific random intercepts:
brm(formula = choice|chid(consumer) ~ price + nutrition + advertising + (1|brand), data)
zijun
July 2, 2023, 1:58pm
3
Thanks! It is very useful.