Multinomial Logit Model

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

pallidness
Posts: 1
Joined: Wed Jul 12, 2017 4:56 am

Multinomial Logit Model

Postby pallidness » Wed Jul 12, 2017 6:58 am

I attempted to estimate a multinomial logit model, with dependent variable being type = 1,2,...,5 and explanatory variables being core, stations, carparks, age gfa, dist_mtr, belt, cycle1 & cycle2. They are undated observations.

I tried to modify the command from an example in EViews, and they are as follows:

' declare parameter vector
coef (10) b2
coef (10) b3
coef (10) b4
coef (10) b5
coef (10) b6
coef (10) b7
coef (10) b8
coef (10) b9
coef (10) b10

mlogit.append xb2 = b2(1)+b2(2)*core+b2(3)*stations+b2(4)*carparks+b2(5)*gfa +b2(6)*age+b2(7)*dist_mtr+b2(8)*belt+b2(9)*cycle1+b2(10)*cycle2
mlogit.append xb3 = b3(1)+b3(2)*core+b3(3)*stations+b3(4)*carparks+b3(5)*gfa +b3(6)*age+b3(7)*dist_mtr+b3(8)*belt+b3(9)*cycle1+b3(10)*cycle2
mlogit.append xb4 = b4(1)+b4(2)*core+b4(3)*stations+b4(4)*carparks+b4(5)*gfa +b4(6)*age+b4(7)*dist_mtr+b4(8)*belt+b4(9)*cycle1+b4(10)*cycle2
mlogit.append xb5 = b5(1)+b5(2)*core+b5(3)*stations+b5(4)*carparks+b5(5)*gfa +b5(6)*age+b5(7)*dist_mtr+b5(8)*belt+b5(9)*cycle1+b5(10)*cycle2

' define prob for each choice
mlogit.append denom = 1+exp(xb2)+exp(xb3)+exp(xb4)+exp(xb5) +exp(xb6)+exp(xb7)+exp(xb8)+exp(xb9) +exp(xb10)
mlogit.append pr1 = 1/denom
mlogit.append pr2 = exp(xb2)/denom
mlogit.append pr3 = exp(xb3)/denom
mlogit.append pr4 = exp(xb4)/denom
mlogit.append pr5 = exp(xb5)/denom

' specify likelihood
mlogit.append logl1 = (1-dd2-dd3-dd4)*log(pr1)+dd2*log(pr2)+dd3*log(pr3)+dd4*log(pr4) +dd5*log(pr5)
' specify analytic derivatives

for!i = 2 to 5
mlogit.append @deriv b{!i}(1) grad{!i}1 b{!i}(2) grad{!i}2 b{!i}(3) grad{!i}3 b{!i}(4) grad{!i}4 b{!i}(5) grad{!i}5
mlogit.append grad{!i}1 = dd{!i}-pr{!i}
mlogit.append grad{!i}2 = grad{!i}1*x1
mlogit.append grad{!i}3 = grad{!i}1*x2
mlogit.append grad{!i}4 = grad{!i}1*x3
mlogit.append grad{!i}5 = grad{!i}1*x4

next
' get starting values from binomial logit
equation eq2.binary(d=l) dd2 c core stations carparks gfa age dist_mtr belt cycle1 cycle2
b2 = eq2.@coefs
equation eq3.binary(d=l) dd3 c core stations carparks gfa age dist_mtr belt cycle1 cycle2
b3 = eq3.@coefs
equation eq4.binary(d=l) dd4 c core stations carparks gfa age dist_mtr belt cycle1 cycle2
b4 = eq4.@coefs
equation eq5.binary(d=l) dd5 c core stations carparks gfa age dist_mtr belt cycle1 cycle2
b5 = eq5.@coefs
equation eq6.binary(d=l) dd6 c core stations carparks gfa age dist_mtr belt cycle1 cycle2

But there is a syntax error in coef (10) b2. It would be much appreciate if anyone can correct me when I am wrong. Thank you in advance.

EViews Glenn
EViews Developer
Posts: 2671
Joined: Wed Oct 15, 2008 9:17 am

Re: Multinomial Logit Model

Postby EViews Glenn » Wed Jul 12, 2017 4:28 pm

No space before the (10)


Return to “Estimation”

Who is online

Users browsing this forum: startz and 39 guests