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

From |
"Dozet Alexander" <Alexander.Dozet@skane.se> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
SV: st: Estimate marginal effects with interaction terms in non-linnear models. |

Date |
Wed, 7 Sep 2005 12:25:51 +0200 |

Hi! Thank you for your help. I'm starting to get the hang of it. Best regards Alexander __________________________________________________________ Alexander Dozet Hälsoekonom Avdelning för uppföljning, analys och styrning Regionhuset Box 1 221 00 Lund Region Skåne Telefon: + 46 (0)46-153628 Mobiltelefon: +46 ( 0)705-253628 E-post: Alexander.Dozet@skane.se -----Ursprungligt meddelande----- Från: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]För maartenbuis Skickat: den 6 september 2005 13:12 Till: statalist@hsphsun2.harvard.edu Ämne: Re: st: Estimate marginal effects with interaction terms in non-linnear models. Hi Alexander, Here are some general remarks about your question (which do not explain your syntax error) and than some code that works on Stata 8.2 (I do not have version 9 yet) but the -version 8.2- command on top of the code should ensure that it also works on your version. First, are you sure you want marginal effects? When using interaction terms you think that the effect of a variables is different for males and females, or foreign and domestic cars, or ... But with marginal effects you summarize these different effects with one number, and thus loose this information. Second, as you already saw the code you used will give you the marginal effect for the probit model instead of the logit model you want to estimate. You can either continue to use the logit and use the example code below, or switch to probit and use the example code provided by the FAQ. Conclusions drawn form either model are usually the same, so the choice can be entirely guided by what is practical for you. Third, -predictnl- will create a new variable in your dataset with the marginal effect as its value. You can see the result with -list xxx, in 1-. -nlcom- is easier: it immediately shows the result, does not do things to your data, and gives you standard errors and confidence intervals. Fourth, there are people who do not like means of dummy variables: have you ever seen someone who is .504 female? They would suggest that you use the modal category. My position is that the modal category is also a good summary measure and using it saves you some whining from these purists. Fifth, if you want easier code than the logit allows you to calculate odds ratios, which is just if the continuous variable is xxx and the interactionterm with the dummy is yyy than the odds ratios are exp(_b[xxx]) when the dummy is zero and exp(_b[xxx]+_b[yyy]) when the dummy is one. See the thread on statalist started by: http://www.stata.com/statalist/archive/2005-04/msg00658.html *-----------begin example code------------ version 8.2 sysuse auto, clear gen good = rep78>=4 if rep78~=. gen forXturn = foreign * turn logit good turn foreign forXturn sum foreign local meanfor = r(mean) sum turn local meanturn = r(mean) local xb = _b[_cons] + _b[turn]*`meanturn' + /* */ _b[forXturn]*`meanturn'*`meanfor' + /* */ _b[foreign]*`meanfor' nlcom exp(`xb')/(1+`xb')^2 * _b[turn] + _b[forXturn]*`meanfor' *--------------end example code------------- For an explanation of why this code works see the thread started by: http://www.stata.com/statalist/archive/2004-11/msg00254.html. Hope this helps, Maarten ---"Dozet Alexander" <Alexander.Dozet@s...> wrote: > Currently I'm trying to estimate marginal effects with a logit model > with 10 interaction terms (one continuous and one dummy). > Furthermore one of the interaction terms is age sqr*male. Hence the > use of -inteff- is not possible. I'm trying to learn how to use the > -predictnl- command but have run into some difficulties. I tried to > re-estimate the probit model that is to be found in "FAQ:I am using > a model with interactions. How can I obtain marginal effects and > their standard errors?" > However when I estimate > ... > local xb _b[turn]*`meantur' + /* > */ _b[dum]*`meandum' + _b[td]*`meantur'*`meandum' + > _b[_cons] > predictnl dydt = normden(`xb')*(_b[turn] + _b[td]*`meandum') in 1, > se(set) > .... > just after -predictnl- i get the error message > invalid syntax > r(198); > Does any one know where the misstake is? * * 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/ * * 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/

- Prev by Date:
**st: Tulika Narayan/bet/Abtassoc is out of the office.** - Next by Date:
**[no subject]** - Previous by thread:
**Re: st: Estimate marginal effects with interaction terms in non-linnear models.** - Next by thread:
**st: RE: sample code in -heckprob-** - Index(es):

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