Statalist The Stata Listserver


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

st: RE: program for difference in marginal effect


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: program for difference in marginal effect
Date   Thu, 25 Jan 2007 09:15:46 +0100

--- Jun Xu wrote:
> Is there any program out there for testing the differences in marginal
> effects (dprob over dx) based on the same binary regression models?

I used -nlcom- to do that some time ago. I just changed it to work on 
the auto dataset. see the example below:

*---------------- begin example -------------------------
sysuse auto, clear
recode rep78 (1/3 = 0) (4/5 =1)


logit foreign price mpg rep78

tempname mprice mmpg
sum price, meanonly
scalar `mprice' = r(mean)
sum mpg, meanonly 
scalar `mmpg' = r(mean)

local xb0 "_b[_cons] + _b[price]*`mprice' + _b[mpg]*`mmpg'"
local xb1 "`xb0' + _b[rep78]"

nlcom (Lprice: _b[price]*invlogit(`xb0')*invlogit(-`xb0')) /*
    */(Hprice: _b[price]*invlogit(`xb1')*invlogit(-`xb1')) /*
    */(Dprice: _b[price]*invlogit(`xb0')*invlogit(-`xb0') - /*
    */         _b[price]*invlogit(`xb1')*invlogit(-`xb1'))

nlcom (Lmpg: _b[mpg]*invlogit(`xb0')*invlogit(-`xb0')) /*
    */(Hmpg: _b[mpg]*invlogit(`xb1')*invlogit(-`xb1')) /*
    */(Dmpg: _b[mpg]*invlogit(`xb0')*invlogit(-`xb0') - /*
    */       _b[mpg]*invlogit(`xb1')*invlogit(-`xb1'))

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

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



*
*   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