Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Marginal effect of interaction var in multinomial logit model


From   Guido Heineck <[email protected]>
To   [email protected]
Subject   st: Marginal effect of interaction var in multinomial logit model
Date   Fri, 14 Sep 2007 16:21:10 +0200

Dear all.

I'm somewhat struggling with calculating marginal effects for interaction variables in a multinomial logit model framework.

Adapting two codes by Maarten L. Buis from prior posts that address related issues (http://www.stata.com/statalist/archive/2005-09/msg00126.html and http://www.datasets.org/statalist/archive/2006-05/msg01057.html) I get some results with the following code but I am unsure as to whether it is correctly programmed.

*-------------- begin example -----------------
#delimit ;
sysuse auto, clear;
recode rep78 2=1 3=1 4=2 5=3 ;

gen forXmpg = foreign * mpg ;

mlogit rep78 foreign mpg forXmpg ;

sum foreign if e(sample) ;
scalar mfor = r(mean) ;
sum mpg if e(sample) ;
scalar mmpg = r(mean) ;

local exp2 "exp([2]_cons + [2]foreign*scalar(mfor)
+ [2]mpg*scalar(mmpg) + [2]forXmpg*scalar(mfor)*scalar(mmpg))" ;

local exp3 "exp([3]_cons + [3]foreign*scalar(mfor)
+ [3]mpg*scalar(mmpg) + [3]forXmpg*scalar(mfor)*scalar(mmpg))" ;

local p1 "1/(1 + `exp2' + `exp3')" ;
local p2 "`exp2'/(1 + `exp2' + `exp3')" ;
local p3 "`exp3'/(1 + `exp2' + `exp3')" ;

nlcom (foreign: `p1'*(0-(`p2'*[2]foreign + `p3'*[3]foreign)))
(mpg: `p1'*(0-(`p2'*[2]mpg + `p3'*[3]mpg)))
(forXmpg: `p1'*(0-(`p2'*[2]forXmpg + `p3'*[3]forXmpg))) ;

*--------------------- end example ------------------

Any comment will be appreciated.
Guido


----------------------------------------------
Please support UNICEF.
http://www.unicef.org
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index