Mc Fadden R square in MLOGIT

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Giugiu
Posts: 7
Joined: Wed May 15, 2013 11:36 am

Mc Fadden R square in MLOGIT

Postby Giugiu » Wed May 22, 2013 2:48 am

Hello,

I am running a multinomial logit regression model with the following program:

------------------------------------------
' declare parameter vector (2 for 2 equations of starting values)
coef(9) b2
coef(9) b3

' set up the likelihood function by issuing a series of append statements
logl mlogit
mlogit.append @logl logl1

mlogit.append xb2 = b2(1)+b2(2)*x1+b2(3)*x2+b2(4)*x3+b2(5)*x4+b2(6)*x5+b2(7)*x6+b2(8)*x7+b2(9)*x8
mlogit.append xb3 = b3(1)+b3(2)*x1+b3(3)*x2+b3(4)*x3+b3(5)*x4+b3(6)*x5+b3(7)*x6+b3(8)*x7+b3(9)*x8

' define prob for each choice
mlogit.append denom = 1+exp(xb2)+exp(xb3)
mlogit.append pr1 = 1/denom
mlogit.append pr2 = exp(xb2)/denom
mlogit.append pr3 = exp(xb3)/denom

' specify likelihood
mlogit.append logl1 = (1-dd2-dd3)*log(pr1)+dd2*log(pr2)+dd3*log(pr3)

' specify analytic derivatives (Generally, Eviews estimate numerical derivatives)
for !i=2 to 3
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 b{!i}(6) grad{!i}6 b{!i}(7) grad{!i}7 b{!i}(8) grad{!i}8 b{!i}(9) grad{!i}9
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
mlogit.append grad{!i}6 = grad{!i}1*x5
mlogit.append grad{!i}7 = grad{!i}1*x6
mlogit.append grad{!i}8 = grad{!i}1*x7
mlogit.append grad{!i}9 = grad{!i}1*x8
next

' get starting values from binomial logit (one choice for starting values for the coefficients of the mean equation)
equation eq2.binary(d=l) dd2 c x1 x2 x3 x4 x5 x6 x7 x8
b2 = eq2.@coefs

equation eq3.binary(d=l) dd3 c x1 x2 x3 x4 x5 x6 x7 x8
b3 = eq3.@coefs

' check whether you have specified the analytic derivatives correctly (fairly close to the numeric derivatives)
freeze(tab1) mlogit.checkderiv
show tab1

' estimate the model
mlogit.ml(showopts,m=1000,c=1e-5)
show mlogit.output
------------------------------------------
I know that in the binary model, the Mc Fadden R square is already provided in the regression output. I would like to know if it is possible to use it in this model as well and how can I add that in this program?

Thank You

G

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Mc Fadden R square in MLOGIT

Postby EViews Gareth » Wed May 22, 2013 7:36 am

You'd have to calculate it manually in the program.

Giugiu
Posts: 7
Joined: Wed May 15, 2013 11:36 am

Re: Mc Fadden R square in MLOGIT

Postby Giugiu » Wed May 22, 2013 7:38 am

Thank you for your answer. Unfortunately I dont get which is the command to calculate it. Can you please help me with that?

Thanks again

G

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Mc Fadden R square in MLOGIT

Postby EViews Gareth » Wed May 22, 2013 7:39 am

There is no command to calculate it.

Giugiu
Posts: 7
Joined: Wed May 15, 2013 11:36 am

Re: Mc Fadden R square in MLOGIT

Postby Giugiu » Wed May 22, 2013 7:57 am

You'd have to calculate it manually in the program.
But here you say it is possible to calculate it manually..How can I calculate it manually then?

Thank You

G

Giugiu
Posts: 7
Joined: Wed May 15, 2013 11:36 am

Re: Mc Fadden R square in MLOGIT

Postby Giugiu » Thu May 23, 2013 7:10 am

Can you help me with calculate the McFadden R2 manually?

thank you

G


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests