How to get average marginal effects (AMEs) with standard errors of mlogit or clogit in R?

114 views Asked by At

I am fitting a conditional logit model in R and want to compute the average marginal effect of a binary predictor (wait_long: 1 if wait time is >= 30). How should I do it? Any thoughts are welcome (solutions to clogit preferred tho).

library(mlogit)
library(survival)

data("TravelMode", package = "AER")

TravelMode <- TravelMode %>%
  mutate(chosen = ifelse(choice == 'no', 0 , 1),
         wait_long = ifelse(wait >= 30, 1, 0))

m_logit <- mlogit(choice ~ wait_long + travel + vcost | 0, TravelMode)
c_logit <- clogit(chosen ~ wait_long + travel + vcost + strata(individual), method = "efron", robust = TRUE, TravelMode)

I tried marginaleffects, effects, and predict. But they are either too slow or wrong in my case, esp. for clogit. My real dataset is much larger and therefore speed matters.

I was also checking Stata posts on this issue (clogit and xtlogit with fe) and it seems it is not appropriate to do AME after xtlogit fe (see this post). aextlogit is instead suggested. But when I run with my data, the coefficients are extremely close to the semi-elasticities. Confused...

0

There are 0 answers