[R] Reg. odds ratio for Nested logit model
Suja Sekhar C
csujasekhar at gmail.com
Tue Jan 3 10:38:37 CET 2017
Hi,
I am new to R. I find that I can get the odds ratio of a logit regression
by typing exp(coef(result)) . However for a nested logit model with an
inclusive value parameter, I am not sure how to get the odds ratio.
My code is below, with m1 containing my results. Please help me to get the
odds-ratios from the coefficients.
library(mlogit)
> dat1<- read.csv("Desktop/me.csv")
> dat1$id <- 1:11304
> dat1$mode <- as.character(dat1$choice_t)
# choice_t is my variable that takes a value 0 ,1 or 2. Here 0 is the only
branch for option A and 1 and 2 are sub-branches of option B.
mdat1 <- subset(dat1, select = c("mode”,”x1”,”x2”, “x3”,”x4”, ”id"))
> ndat1 <- mlogit.data(mdat1, shape="wide", choice="mode")
# This creates 2 other alternatives as per the requirement of Nested Logit
model. There should be a set of variables for all the options 0, 1, and 2.
File ndat1 has therefore 3*11304 = 33912 firm- year observations.
Mode variable =1 for the choice that the firm makes in that year. So if the
firm has made a choice of 2 in an year it will take the value 1 for only
that firm-year observation.
> m1 <- mlogit(mode ~ 1| x1+x2+x3+x4, data=ndat1, + nests =
list(optionA=c("0"), optionB=c("1","2")),un.nest.el=TRUE )
> summary(m1)
Thank you,
Suja
[[alternative HTML version deleted]]
More information about the R-help
mailing list