Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Obtaining marginal effects and their standard errors after estimations with interactions


From   Ebru Ozturk <ebru_0512@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Obtaining marginal effects and their standard errors after estimations with interactions
Date   Mon, 7 Jan 2013 19:00:12 +0200

Thank you very much, it helped a lot :)

----------------------------------------
> Date: Mon, 7 Jan 2013 15:08:18 +0000
> Subject: Re: st: Obtaining marginal effects and their standard errors after estimations with interactions
> From: arnehole@gmail.com
> To: statalist@hsphsun2.harvard.edu
>
> It's possible to get pretty close when both variables are continuous
> as well, using a finite difference approximation. The code below
> approximates "dydlw" in the FAQ.
>
> sysuse auto, clear
> replace weight=weight/1000
> replace length=length/10
> probit foreign weight length c.weight#c.length, nolog
> margins, dydx(*) atmeans at(weight=3.019559)
> matrix b = r(b)
> scalar meff_turn_1 = b[1,2]
> margins, dydx(*) atmeans at(weight=3.019459)
> matrix b = r(b)
> scalar meff_turn_0 = b[1,2]
>
> di (meff_turn_1 - meff_turn_0)/0.0001
>
> I'm not saying that this is a good way of actually performing these
> calculations, but it does help in giving some intuition to what the
> numbers represent (at least I think so).
>
> Arne
>
> On 7 January 2013 13:41, Arne Risa Hole <arnehole@gmail.com> wrote:
> > I don't have much to add to what Richard has already said on this
> > topic but I just wanted to mention one thing: if the interaction is
> > between a continuous variable and a dummy variable, then the second
> > derivative (or "marginal effect of the interaction") is the difference
> > between the marginal effect of the continuous variable when the dummy
> > is "switched on" and when dummy is "switched off". The code below
> > replicates the final result in the FAQ (this uses -margins- so
> > requires Stata 11 or higher).
> >
> > sysuse auto, clear
> > set seed 12345
> > generate dum=uniform()>0.5
> > table dum
> > probit foreign turn i.dum i.dum#c.turn, nolog
> >
> > margins, dydx(*) atmeans at(dum=1)
> > matrix b = r(b)
> > scalar meff_turn_dum1 = b[1,1]
> > margins, dydx(*) atmeans at(dum=0)
> > matrix b = r(b)
> > scalar meff_turn_dum0 = b[1,1]
> >
> > di meff_turn_dum1 - meff_turn_dum0
> >
> > Arne
> >
> > On 6 January 2013 13:11, Ebru Ozturk <ebru_0512@hotmail.com> wrote:
> >> But without getting separate interaction terms, how do we know that the moderator affects the relationship between x and y positively or negatively?
> >>
> >> ----------------------------------------
> >>> Date: Sat, 5 Jan 2013 13:39:53 -0500
> >>> To: statalist@hsphsun2.harvard.edu; statalist@hsphsun2.harvard.edu
> >>> From: richardwilliams.ndu@gmail.com
> >>> Subject: RE: st: Obtaining marginal effects and their standard errors after estimations with interactions
> >>>
> >>> Thanks for the references. FYI, if you have Stata
> >>> 11 or higher, here is how you can easily
> >>> reproduce almost everything that is in the FAQ at
> >>> http://www.stata.com/support/faqs/statistics/marginal-effects-after-interactions/
> >>> -- the one exception being that you DON'T get
> >>> separate marginal effects for the interaction terms.
> >>>
> >>> sysuse auto, clear
> >>> regress mpg weight c.weight#c.weight
> >>> margins, dydx(*) atmeans
> >>> sysuse auto, clear
> >>> replace weight=weight/1000
> >>> replace length=length/10
> >>> probit foreign weight length c.weight#c.length, nolog
> >>> margins, dydx(*) atmeans
> >>> sysuse auto, clear
> >>> set seed 12345
> >>> generate dum=uniform()>0.5
> >>> table dum
> >>> probit foreign turn i.dum i.dum#c.turn, nolog
> >>> margins, dydx(*) atmeans
> >>>
> >>> With regards to the references, Greene is
> >>> brilliant but I wish he would write in English
> >>> and use Stata examples. I think he is saying that
> >>> the marginal effect of the interaction is not
> >>> useful. The other two articles are also
> >>> expressing concerns or suggesting alternatives. I
> >>> am also not a big fan of using MEMs (marginal
> >>> effects at the means); AMEs (Average Marginal
> >>> Effects) make more sense to me, especially when
> >>> categorical variables are involved.
> >>>
> >>> If the marginal effect of the interaction term is
> >>> useful or even valid, I continue to wonder why
> >>> -margins- does not provide it. And what exactly
> >>> does it mean? The interaction term can't change
> >>> independently of the variables used to compute the interaction.
> >>>
> >>> At 11:53 AM 1/5/2013, André Ferreira Coelho wrote:
> >>> >Dear all,
> >>> >
> >>> >As far as i know there is no consensus on whether margins should be
> >>> >computed for marginal terms.
> >>> >
> >>> >Maybe you are interested in using odds for interactions instead of
> >>> >margins.
> >>> >
> >>> >But you might want to take a look on some literature:
> >>> >
> >>> >http://www.maartenbuis.nl/publications/interactions.pdf
> >>> >
> >>> >http://pages.stern.nyu.edu/~wgreene/DiscreteChoice/Readings/Greene-Chapter-23.pdf
> >>> >
> >>> >http://www.stata-journal.com/sjpdf.html?articlenum=st0063
> >>> >
> >>> >Best,
> >>> >
> >>> >Andre
> >>> >
> >>> >
> >>> >
> >>> > > From: ebru_0512@hotmail.com
> >>> > > To: statalist@hsphsun2.harvard.edu
> >>> > > Subject: RE: st: Obtaining marginal effects and their standard errors
> >>> >after estimations with interactions
> >>> > > Date: Sat, 5 Jan 2013 13:32:47 +0200
> >>> > >
> >>> > > Yes,that's true but I dont think it is wrong to produce a separate
> >>> >marginal
> >>> >effect. Also this 2004 FAQ is for Stata 10. Maybe that's the reason to
> >>> >still have this information on FAQ page.
> >>> >
> >>> >----------------------------------------
> >>> > > Date: Fri, 4 Jan 2013 15:15:58 -0500
> >>> > > To: statalist@hsphsun2.harvard.edu; statalist@hsphsun2.harvard.edu
> >>> > > From: richardwilliams.ndu@gmail.com
> >>> > > Subject: RE: st: Obtaining marginal effects and their standard errors
> >>> >after estimations with interactions
> >>> > >
> >>> > > At 12:24 PM 1/4/2013, Ebru Ozturk wrote:
> >>> > > >It's not that hard, just you need to be careful. Stata 10 is the
> >>> > > >only choice for me. I just need an example that inludes a few more
> >>> > > >independent and control variables.
> >>> > > >
> >>> > > >Ebru
> >>> > >
> >>> > > I think it is interesting that the -margins- command works somewhat
> >>> > > differently than the approach presented in the FAQ. In particular,
> >>> > > margins does not produce a separate marginal effect for the
> >>> > > interaction term while the FAQ approach does. This makes me wonder if
> >>> > > (a) the 2004 FAQ is now considered wrong, or (b) both the FAQ and
> >>> > > margins approaches are considered legitimate but alternative
> >>> > > approaches. Personally, I think what margins does is very logical,
> >>> > > but nonetheless people keep on asking for marginal effects of
> >>> > > interaction terms.
> >>> > >
> >>> > > >----------------------------------------
> >>> > > > > From: richardwilliams.ndu@gmail.com
> >>> > > > > Date: Fri, 4 Jan 2013 11:56:50 -0500
> >>> > > > > Subject: Re: st: Obtaining marginal effects and their standard
> >>> > > > errors after estimations with interactions
> >>> > > > > To: statalist@hsphsun2.harvard.edu
> >>> > > > >
> >>> > > > > I hate trying to do something like this by hand. Too much room for
> >>> > > > > error. Can't you tell whoever you work for that you can't be
> >>> >expected
> >>> > > > > to work under such primitive inhumane conditions and you need Stata
> >>> > > > > 12?
> >>> > > > >
> >>> > > > > You might check out the user-written -inteff- command and see if it
> >>> > > > > helps. -margeff- is another user-written command that has various
> >>> > > > > advantages over -mfx-.
> >>> > > > >
> >>> > > > > Sent from my iPad
> >>> > > > >
> >>> > > > > On Jan 4, 2013, at 11:33 AM, Ebru Ozturk wrote:
> >>> > > > >
> >>> > > > > > Thank you, I use Stata 10 therefore I asked this question. I
> >>> > > > just wonder when we have more independent or control variables how
> >>> > > > do we adjust the given equations on this link:
> >>> > > >
> >>> >http://www.stata.com/support/faqs/statistics/marginal-effects-after-interactions/
> >>> >[1]
> >>> > > > > >
> >>> > > > > > Kind regards
> >>> > > > > > Ebru
> >>> > > > > >
> >>> > > > > > ----------------------------------------
> >>> > > > > >> Date: Fri, 4 Jan 2013 09:32:25 -0500
> >>> > > > > >> To: statalist@hsphsun2.harvard.edu;
> >>> >statalist@hsphsun2.harvard.edu
> >>> > > > > >> From: richardwilliams.ndu@gmail.com
> >>> > > > > >> Subject: Re: st: Obtaining marginal effects and their standard
> >>> > > > errors after estimations with interactions
> >>> > > > > >>
> >>> > > > > >> At 03:17 PM 1/3/2013, Ebru Ozturk wrote:
> >>> > > > > >>
> >>> > > > > >>> Dear All,
> >>> > > > > >>>
> >>> > > > > >>> On Stata FAQs' page, there are some given examples for Probit
> >>> > > > > >>> estimation with interaction effects for Stata 10 titled as "I am
> >>> > > > > >>> using a model with interactions. How can I obtain marginal
> >>> >effects
> >>> > > > > >>> and their standard errors?" and the link is:
> >>> > > > > >>>
> >>> > > >
> >>> >http://www.stata.com/support/faqs/statistics/marginal-effects-after-interactions/
> >>> >[2]
> >>> > > > > >>>
> >>> > > > > >>> Do you think this way is still applicable to Probit estimation?
> >>> >and
> >>> > > > > >>> Is the below command correct when we have other independent or
> >>> > > > > >>> control variables?
> >>> > > > > >>
> >>> > > > > >> I don't know if you did it right or not, but if you have Stata 11
> >>> >or
> >>> > > > > >> higher why not use -margins-, e.g.
> >>> > > > > >>
> >>> > > > > >> sysuse auto, clear
> >>> > > > > >> probit foreign weight length c.weight#c.length, nolog
> >>> > > > > >> margins, dydx(*)
> >>> > > > > >>
> >>> > > > > >>> local xb _b[weight]*`meanwei' + _b[len]*`meanlen' +
> >>> > > > > >>> _b[wl]*`meanwei'*`meanlen' + _b[C1]*C1+_b[C2]*C2 + _b[_cons] //
> >>> >if
> >>> > > > > >>> more variables //
> >>> > > > > >>>
> >>> > > > > >>> /////// example /////////
> >>> > > > > >>>
> >>> > > > > >>> sysuse auto, clear
> >>> > > > > >>> generate wl=weight*length
> >>> > > > > >>> probit foreign weight length wl, nolog
> >>> > > > > >>> quietly summarize weight if e(sample)
> >>> > > > > >>> local meanwei = r(mean)
> >>> > > > > >>> quietly summarize length if e(sample)
> >>> > > > > >>> local meanlen = r(mean)
> >>> > > > > >>>
> >>> > > > > >>> local xb _b[weight]*`meanwei' + _b[len]*`meanlen' +
> >>> > > > > >>> _b[wl]*`meanwei'*`meanlen' + _b[_cons]
> >>> > > > > >>> predictnl dydw = normalden(`xb')*(_b[weight]+
> >>> > > > _b[wl]*`meanlen') in 1, se(sew)
> >>> > > > > >>> list dydw sew in 1
> >>> > > > > >>>
> >>> > > > > >>> predictnl dydl = normalden(`xb')*(_b[len]+ _b[wl]*`meanwei')
> >>> > > > in 1, se(sel)
> >>> > > > > >>> list dydl sel in 1
> >>> > > > > >>>
> >>> > > > > >>> predictnl dydlw =normalden(`xb')*(-(`xb'))*(_b[weight]+
> >>> > > > > >>> _b[wl]*`meanlen')*(_b[len]+ _b[wl]*`meanwei') +
> >>> >normalden(`xb')*(
> >>> > > > > >>> _b[wl]) in 1, se(selw)
> >>> > > > > >>> list dydlw selw in 1
> >>> > > > > >>>
> >>> > > > > >>> Ebru
> >>> > > > > >>
> >>>
> >>> -------------------------------------------
> >>> Richard Williams, Notre Dame Dept of Sociology
> >>> OFFICE: (574)631-6668, (574)631-6463
> >>> HOME: (574)289-5227
> >>> EMAIL: Richard.A.Williams.5@ND.Edu
> >>> WWW: http://www.nd.edu/~rwilliam
> >>>
> >>>
> >>> *
> >>> * For searches and help try:
> >>> * http://www.stata.com/help.cgi?search
> >>> * http://www.stata.com/support/faqs/resources/statalist-faq/
> >>> * http://www.ats.ucla.edu/stat/stata/
> >> *
> >> * For searches and help try:
> >> * http://www.stata.com/help.cgi?search
> >> * http://www.stata.com/support/faqs/resources/statalist-faq/
> >> * http://www.ats.ucla.edu/stat/stata/
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/ 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index