Statalist The Stata Listserver


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

st: predictnl, marginal effects and interaction effects


From   "Gauri Khanna" <[email protected]>
To   [email protected]
Subject   st: predictnl, marginal effects and interaction effects
Date   Fri, 11 May 2007 08:31:30 +0000

Dear Stata List,

I am using a probit model on cross sectional survey data(Stata version 9.2). I would like to calculate the interaction effects and marginal effects for two of my dummmies-pipewaterdummy and wellwaterdummy. I am using the -predictnl- command. However, I need to derive the interaction effects and marginal effects and then use -predictnl-. I looked at an example in StataFAQ but my model has interaction terms arising from two water dummies which is more complex than shown in the example and I am stuck here. I would very grateful if someone could please help me out. I do not have access to a Statistician, so I would be really grateful for someone's advice.

My question is : (1) when calculating the Marginal effects of,
say pipewaterdummy, do I keep all the other variables, continuous and dummies, including those in the other interaction terms (i.e. those not involving pipewaterdummy such as the terms age*wellwaterdummy and wealthlowdummy*wellwaterdummy) at their mean values?

(2) Could someone please help me in the correct derivation of interaction effect. I am at a complete loss-I have made an attempt but am not sure whether it is correct.

I show below my model and attempts at deriving marginal and interaction effects using Stata codes.

My model :

Diarrhoea: Dependant (binary variable):
Age: continuous variable
Wealthlowdum pipewaterdummy wellwaterdummy: dummies

MODEL

Y(binary)= c+ age + wealthlowdummy
+ pipewaterdummy + age*pipewaterdummy + wealthlowdummy*pipewaterdummy
+ wellwaterdummy + age*wellwaterdummy + wealthlowdummy*wellwaterdummy

svy: probit diarrhoea age wealthlowdum pipewaterdummy age*pipewaterdummy
wealthlowdummy*pipewaterdummy wellwaterdummy age*wellwaterdummy
wealthlowdummy*wellwaterdummy

*To calculate Marginal effect of pipedwater dummy:
/*When pipewater=1*/
local xb1 _b[age]*`meanage'+_b[wealthlowdummy]*`meanwealthlowdummy'+
_b[pipewaterdummy]*1+
_b[agepipewaterdummy]*`meanage'*1 +
_b[wealthlowdummypipewaterdummy]*`meanwealthlowdum'*1+
+_b[wellwaterdummy]*`meanwellwaterdummy'+_b[agewellwaterdummy]*`meanage'*`meanwellwaterdummy'
+_b[wealthlowdummywellwaterdummy]*`meanwealthlowdummy'*`meanwellwaterdummy'

/*When pipewater=0*/l
local xb0 _b[age]*`meanage'+_b[wealthlowdummy]*`meanwealthlowdummy'
+ _b[pipewaterdummy]*0
+ _b[agepipewaterdummy]*`meanage'*0
+ _b[wealthlowdummypipewaterdummy]*`meanwealthlowdum'*0
+ _b[wellwaterdummy]*`meanwellwaterdummy' +_b[agewellwaterdummy]*`meanage'*`meanwellwaterdummy'
+_b[wealthlowdummywellwaterdummy]*`meanwealthlowdummy'*`meanwellwaterdummy'


*Marginal Effect of piped water dummy
predictnl ddiarrdpipe1= normal(`xb1')-normal(`xb0') in 1, se(sepipe)

*To calculate Interaction Effect of pipedwater dummy with agen and wealthlowdummy:

predictnl ddiarrdpipeage = normalden(`xb1')*(_b[age] +_b[agepipewaterdummy] + _b[agewellwaterdummy] ) - normalden(`xb0')(_b[age] + _b[agewellwaterdummy]) in 1, se(sepw) /*Is this correct?*/

predictnl ddiarrdpipewealth = normalden(`xb1')*(_b[wealthlowdummy] + _b[wealthlowdummypipewaterdummy] + _b[wealthlowdummywellwaterdummy] ) - normalden(`xb0')(_b[wealthlowdummy] + _b[wealthlowdummywellwaterdummy] ) in 1, se(sepa)
/*Is this correct?*/


I would very grateful for your help.

Gauri

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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