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]

st: RE: outreg2 combined with xtivreg2


From   "Schaffer, Mark E" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: outreg2 combined with xtivreg2
Date   Tue, 27 Aug 2013 21:03:05 +0000

Giacomo,

I'm not sure exactly what the problem is.

I tried using the savefirst option with both ivreg2 and xtivreg2.  In both cases, the first-stage regressions were saved and I could replay them or restore them.

For example, using the abdata set, after

	webuse abdata, clear
	ivreg2 n (ys = w k), savefirst
	xtivreg2 n (ys = w k), savefirst fe

when I say

	est dir

I get

-------------------------------------------------------------------------
        name | command      depvar       npar  title 
-------------+-----------------------------------------------------------
  _ivreg2_ys | ivreg2       ys              3  First-stage regression: ys
_xtivreg2_ys | xtivreg2     ys              2  
-------------------------------------------------------------------------

I can use est replay or est restore with either of these saved results.  So I don't see what the problem is.

I do note the discrepancy in terms of variables in memory.  As you note, the saved first-stage estimation with ivreg2 creates an esample() variable:

              storage  display     value
variable name   type   format      label      variable label
------------------------------------------------------------------------------------------------------------
_est__ivreg2_ys byte   %8.0g                  esample() from estimates store

And savefirst with xtivreg2 does not create a corresponding variable.

I would need to check, but this is probably because xtivreg2 uses preserve/restore and newly created variables get lost when the original dataset is restore-d at the end.

But I don't see what this has to do with "exporting first stage results".

--Mark

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Giacomo PALLARO
> Sent: 22 August 2013 14:52
> To: [email protected]
> Subject: st: outreg2 combined with xtivreg2
> 
> Dear all,
> I'm running on Stata 12 some IV regressions using xtivreg2 and I would like to
> print the results using outreg2.
> The help file of xtivreg2 sends you to the help section of ivreg2, where you can
> find:
> 
> The savefirst option requests that the individual first-stage regressions be saved
> for later access using the estimates command.  If saved, they can also be
> displayed using first or ffirst and the ivreg2 replay syntax.  The regressions are
> saved with the prefix "_ivreg2_", unless the user specifies an alternative prefix
> with the savefprefix(prefix) option.
> 
> Using ivreg2 with first savefirst options, I noticed that Stata generates a
> variable _est__ivreg2_varname. Then using the command "  outreg2
> [_ivreg2_*]   " I'm able to export the first stage results correctly.
> Unfortunately with xtivreg2 this doesn't occur. In particular no
> _est__xtivreg2_varname is generated, despite I get (similarly to ivreg2 case)
> this expression just before the first stage output of xtivreg2
> 
> Stored estimation results
> --------------------------------------------------------------------------------
>         name    |     command      depvar       npar     title
> -------------------+-----------------------------------------------------------
> _xtivreg2_~d  |      xtivreg2     L.notemplo~d    7
> --------------------------------------------------------------------------------
> 
> Am I wrong somewhere? Is it possible to export first stage results of xtivreg2 in
> this way? Are there other ways to do it using outreg2?
> 
> Thank you all in advance,
> Giacomo



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