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: Saving first-stage y_hat from xtivreg2


From   "Schaffer, Mark E" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Saving first-stage y_hat from xtivreg2
Date   Mon, 14 Mar 2011 22:52:52 -0000

May,

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> [email protected]
> Sent: 14 March 2011 22:28
> To: [email protected]
> Subject: Re: st: RE: Saving first-stage y_hat from xtivreg2
> 
> Thanks Mark. 
> 
> Do you think I can construct id dummies for each i - so it is 
> no longer a panel, but a time series with time-invariant 
> dummies - and use ivreg2?
> 
> So the model is now:
> 
> ivreg2 gmm y1 x1 x2 x3 dum1 dum2... (y2 = z1), first savefirst
> 
> estimates restore _ivreg2_y2
> 
> predict pred_y2
>   
> 
> Will the predicted values of y2 be consistent and unbiased? 
> Will the loss of efficiency be great?

It's a good idea - you should, in fact, get exactly the same results as
the FE estimator.  A potential problem is that you might have too many
dummies, but even if it's a few hundred it should still work.

--Mark

> 
> Thanks again, May
> 
> 
> 
> 
> 
> ------------------
> 
> -----Original Message-----
> From: "Schaffer, Mark E" <[email protected]>
> Sender: [email protected]
> Date: Mon, 14 Mar 2011 20:26:18
> To: <[email protected]>
> Reply-To: [email protected]: RE: st: RE: 
> Saving first-stage y_hat from xtivreg2
> 
> May,
> 
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of 
> > [email protected]
> > Sent: 14 March 2011 19:58
> > To: [email protected]
> > Subject: Re: st: RE: Saving first-stage y_hat from xtivreg2
> > 
> > Hi Mark,
> > 
> > Thanks for the tip. I should have said that I tried it, but 
> it didn't 
> > work.
> > 
> > I entered:
> > 
> > xtivreg2 y1 x1 x2 x3 (y2 = z1), gmm2s kernel barlett bw(1) fe first 
> > savefirst
> > 
> > estimates restore _xtivreg2_y2
> > 
> > predict pred_y2
> > 
> > 
> > But the fitted values of y2 were not produced
> > 
> > Have I missed a step?
> 
> Oops ... no, the problem isn't with what you did.
> 
> -xtivreg2- performs the within (or, alternatively, first 
> differences) transformation before estimating.
> 
> Saving the first stage regression and then restoring the 
> results won't work, because -xtivreg2- isn't set up to 
> generate predicted values of transformed variables.  Sorry 
> for steering you in the wrong direction.
> 
> The only option I can think of is to do the within 
> transformation by hand (Ben Jann's -center- command is good 
> for that) and then use
> -ivreg2- with the undocumented dofminus() option to account 
> for the degrees of freedom lost to the fixed effects.  The 
> saved first stage should be able to let you generate fitted 
> values, but these will be predictions of the demeaned 
> endogenous regressor, not the original.
> 
> --Mark
> 
> > 
> > Many thanks, May
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ------------------
> > 
> > -----Original Message-----
> > From: "Schaffer, Mark E" <[email protected]>
> > Sender: [email protected]
> > Date: Mon, 14 Mar 2011 18:18:05
> > To: <[email protected]>
> > Reply-To: [email protected]: st: RE: 
> > Saving first-stage y_hat from xtivreg2
> > 
> > May,
> > 
> > > -----Original Message-----
> > > From: [email protected]
> > > [mailto:[email protected]] On Behalf Of 
> > > [email protected]
> > > Sent: 14 March 2011 17:39
> > > To: [email protected]
> > > Subject: st: Saving first-stage y_hat from xtivreg2
> > > 
> > > Hi, I have an issue getting stata to predict first-stage
> > y2_hat. Can
> > > someone help please?
> > > 
> > > My data are panel. 
> > > 
> > > My model is:
> > > 
> > >  xtivreg2 y1 x1 x2 x3 (y2 = z1), gmm2s kernel barlett 
> bw(1) fe first
> > > 
> > > So first stage is:
> > > y2 x1 x2 x3 z1
> > > 
> > > How do I get predicted y2 please?
> > 
> > Have a look at the -savefirst- option as described in -help ivreg2-.
> > 
> > Cheers,
> > Mark
> > 
> > > 
> > > Tried "predict pred_y2, equation(first)" but this doesn't work. 
> > > 
> > > Thanks!
> > > 
> > > May
> > > 
> > > 
> > > 
> > > ------------------
> > > 
> > > *
> > > *   For searches and help try:
> > > *   http://www.stata.com/help.cgi?search
> > > *   http://www.stata.com/support/statalist/faq
> > > *   http://www.ats.ucla.edu/stat/stata/
> > > 
> > 
> > 
> > --
> > 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/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/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> > 
> 
> 
> --
> 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/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/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


-- 
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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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