'Multinomial logit using rstanarm

I know that you can fit a binomial logit model with the rstanarm package by using stan_glm and setting family = binomial(link="logit"), but does rstanarm give you the option to fit a multinomial logit model ?

I found this https://stats.stackexchange.com/questions/24705/can-i-use-glm-algorithms-to-do-a-multinomial-logistic-regression

but i am confused on how to translate the model Y=A+BX into the form that is mentioned there.



Solution 1:[1]

The multinomial logit model cannot currently be estimated with the rstanarm R package. There is a long-standing issue to implement it, which would not be too difficult, but we have been more focused on the more difficult problem of getting a multinomial probit model implemented. I believe you can do a multinomial logit model with the brm function in the brms R package, which also uses Stan to draw from the posterior distribution.

Solution 2:[2]

The brms supports multinomial models. Here are two methods:

library(foreign) 
library(brms)

#data source: https://stats.idre.ucla.edu/r/dae/multinomial-logistic-regression/
ml <- read.dta("https://stats.idre.ucla.edu/stat/data/hsbdemo.dta")
ml$prog2 <- relevel(ml$prog, ref = "academic")

#Method 1:
m1 <- brm(prog2 ~ ses + write, data = ml, family = multinomial(link = "logit"))
summary(m1)

#Method 2:
m2 <- brm(prog ~ ses + write, data = ml, family = categorical(link = "logit"))
summary(m2)

Solution 3:[3]

You could use stan_polr, see "Regression and Other Stories" for an example (section 15.5). E.g.

library(rstanarm)
fit <- stan_polr(factor(vote) ~ value, data = data_401, prior = R2(0.3, "mean))

Taken from https://avehtari.github.io/ROS-Examples/Storable/storable.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ben Goodrich
Solution 2 Mario GS
Solution 3 Neil