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: RE: Re: Marginal effects after ivreg2


From   "Schaffer, Mark E" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: RE: Re: Marginal effects after ivreg2
Date   Wed, 15 Jan 2014 18:06:07 +0000

Suyin,

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Suyin Chang
> Sent: 15 January 2014 10:02
> To: [email protected]
> Subject: Re: st: RE: Re: Marginal effects after ivreg2
> 
> Dear Mark,
> 
> This was quite helpful. I was trying something very similar, but making a silly
> mistake in how to call the values generated in the loop. Thanks for the lines of
> code.
> While we wait to see if there will be any suggestions coming from the list
> regarding how to plot those values, I would like to bring you still another
> follow-up question to push forward these workarounds. As we are here talking
> about how to make marginal effects available to
> -ivreg2- while it does not integrate directly with -margins-, one question comes
> to my mind: what about clustered se?
> 
> One of the main reasons I frequently to 2sls in Stata (besides trying to isolate
> misspecification errors in individual equations when I run nonrecursive
> models), is its much greater flexibility than the 3sls estimation from -reg3-
> regarding the the standard errors, e.g. the robust and cluster possibilities.
> Therefore, when we use cluster se in the 2sls estimation through cluster(var) as
> an option, what would be your suggestion on how to present meaningful
> marginal effects for interaction terms?

Cluster-robust SEs just affect the SEs.  -nlcom- doesn't care where the VCE comes from.  If it's cluster-robust, then the marginal effects will be cluster-robust.  So I don't see what the issue is. 

Cheers,
Mark

NB:   My other suggestion is to use a new subject heading when starting a new thread, as per the Statalist FAQ. :o)

> 
> Thanks for your insights.
> 
> Suyin
> 
> 2014/1/14 Schaffer, Mark E <[email protected]>:
> > Suyin,
> >
> >> -----Original Message-----
> >> From: Suyin Chang [mailto:[email protected]]
> >> Sent: 14 January 2014 06:19
> >> To: [email protected]; Schaffer, Mark E
> >> Subject: Re: st: RE: Re: Marginal effects after ivreg2
> >>
> >> Dears Jana and Mark,
> >>
> >> Very interesting question, followed by a promising reply.
> >> However, I would like to ask two quick follow-up questions, if I may.
> >>
> >> The first problem is I don't get how to mimic -margins- with -nlcom-
> >> after
> >> ivreg2 in case we want a linear plot. For instance, how to mimic
> >> something like margins, dydx(mgp) at(turn=(start(by)end)), where
> >> start is the first value and end is the last value of the variable
> >> turn to be considered? That appears to me as something less intuitive to
> achieve.
> >
> > This is also easy to do - all you need to do is loop through the values and apply
> -nlcom- each time.  Here is a modified version of my original example with -
> regress-:
> >
> > sysuse auto, clear
> > gen mpgturn=mpg*turn
> >
> > regress price mpg turn mpgturn
> > forvalues x=31(1)51 {
> >         nlcom _b[mpg] + _b[mpgturn]*(`x') }
> >
> > regress price mpg turn c.mpg#c.turn
> > margins, dydx(mpg) at(turn=(31(1)51))
> >
> >> And the second thing is to ask if there is a way to easily plot those
> >> results such as marginsplot does with margins saved output.
> >
> > Maybe someone else has some suggestions here...?
> >
> > --Mark
> >
> >
> >> Any suggestions would be very much appreciated, as I am facing the
> >> same need as Jana in the original question, i.e. I need to generate a
> >> marginal effects plot for an interaction between the endogenous
> >> explanatory variable and a exogenous explanatory variable (both
> continuous).
> >>
> >> Thanks,
> >>
> >> Suyin
> >>
> >>
> >>
> >>
> >>
> >> 2013/12/26 Schaffer, Mark E <[email protected]>:
> >> > Jana,
> >> >
> >> > -ivreg2- doesn't (yet - we really need to add this in!) support
> >> > -margins-.  But
> >> an easy workaround is to use -nlcom- with -ivreg2-.
> >> >
> >> > Below is an example of how to use -nlcom- to mimic -margins- to
> >> > calculate
> >> marginal effects and CIs when you have an interaction.
> >> >
> >> > HTH,
> >> > Mark
> >> >
> >> > sysuse auto, clear
> >> > gen mpgturn=mpg*turn
> >> > regress price mpg turn mpgturn
> >> > qui sum turn, meanonly
> >> > nlcom _b[mpg] + _b[mpgturn]*(`r(mean)') qui sum mpg, meanonly nlcom
> >> > _b[turn] + _b[mpgturn]*(`r(mean)') regress price mpg turn
> >> > c.mpg#c.turn margins, atmeans dydx(*)
> >> >
> >> >> -----Original Message-----
> >> >> From: [email protected] [mailto:owner-
> >> >> [email protected]] On Behalf Of Jana von Stein
> >> >> Sent: 26 December 2013 01:59
> >> >> To: <[email protected]>
> >> >> Subject: st: Re: Marginal effects after ivreg2
> >> >>
> >> >> Hello,
> >> >>
> >> >> I need to run margins (or calculate marginal effects with ci's)
> >> >> after ivreg2. I have an endogenous interaction and want to
> >> >> calculate the marginal effect (w/
> >> >> ci's) after ivreg2. Does anyone know how to do this? Margins did
> >> >> not seem to work after ivreg2.
> >> >>
> >> >> Thanks, and happy holidays.
> >> >> Jana
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> *
> >> >> *   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/
> >> >
> >> >
> >> > -----
> >> > Sunday Times Scottish University of the Year 2011-2013 Top in the
> >> > UK for student experience Fourth university in the UK and top in
> >> > Scotland (National Student Survey 2012)
> >> >
> >> > We invite research leaders and ambitious early career researchers
> >> > to join us in leading and driving research in key inter-disciplinary themes.
> >> > Please see www.hw.ac.uk/researchleaders for further information and
> >> > how to apply.
> >> >
> >> > Heriot-Watt University is a Scottish charity registered under
> >> > charity number SC000278.
> >> >
> >> >
> >> > *
> >> > *   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/
> >
> >
> > -----
> > Sunday Times Scottish University of the Year 2011-2013 Top in the UK
> > for student experience Fourth university in the UK and top in Scotland
> > (National Student Survey 2012)
> >
> >
> > We invite research leaders and ambitious early career researchers to
> > join us in leading and driving research in key inter-disciplinary themes.
> > Please see www.hw.ac.uk/researchleaders for further information and
> > how to apply.
> >
> > Heriot-Watt University is a Scottish charity registered under charity
> > number SC000278.
> >
> >
> > *
> > *   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/


----- 
Sunday Times Scottish University of the Year 2011-2013
Top in the UK for student experience
Fourth university in the UK and top in Scotland (National Student Survey 2012)

We invite research leaders and ambitious early career researchers to 
join us in leading and driving research in key inter-disciplinary themes. 
Please see www.hw.ac.uk/researchleaders for further information and how
to apply.

Heriot-Watt University is a Scottish charity
registered under charity number SC000278.


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