Statalist


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

Re: st: Using outreg2 in combination with ivreg2? (the living dead)


From   Christian Weiß <mail@cweiss.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Using outreg2 in combination with ivreg2? (the living dead)
Date   Wed, 2 Sep 2009 14:09:31 -0400

Thx a lot, works great!

It definitely would be a got idea to integrate it in outreg2.

Best
Chris


On Wed, Sep 2, 2009 at 10:58 AM, Roy Wada<roywada@hotmail.com> wrote:
>> I was wondering if there is any way to use outreg2 in combination with
>> ivreg2 (or perhaps ivreg) to report the "standard" 2SLS Output (First
>> stage regression in the top rows of the first column, second stage
>> regression in the bottom of the second stage regression).
>>
>> Chris
>
> This keeps coming back like the night of living dead. Beyond what
> was answered by Martin's answer, Chris is asking to stack the results.
>
> It probably makes sense to report the results of ivreg/ivreg2/ivregress
> as a multi-equation estimation. For various reasons this has never been
> done.
>
> The following codes will make a multi-equation output out of -ivreg2, savefirst-.
> It probably should be sent to ssc or internalized into outreg2. Note that
> this program, -ivreg2out-, can be used with other table-making programs.
>
> Roy
>
> *! ivreg2out 0.9 roywada@hotmail.com
> prog define ivreg2out, eclass
> version 8.0
> qui {
> args one two
> local name1=subinstr("`one'","_ivreg2_","",1)
> local name2=subinstr("`two'","_ivreg2_","",1)
> est restore `one'
> mat b1=e(b)
> mat V1=e(V)
> matrix coleq b1 = `name1'
> matrix coleq V1 = `name1'
> local r2_first=e(r2)
> est restore `two'
> mat b2=e(b)
> mat V2=e(V)
> matrix coleq b2 = `name2'
> matrix coleq V2 = `name2'
> mat b=b1,b2
> mat v1=vecdiag(V1)
> mat v2=vecdiag(V2)
> mat v=v1,v2
> mat V=diag(v)
> local r2_second=e(r2)
> local N=e(N)
> eret post b V
> eret scalar N=`N'
> eret scalar r2_1=`r2_first'
> eret scalar r2_2=`r2_second'
> eret loc eqnames= "`name1' `name2'"
> eret loc depvar= "`name1' `name2'"
> }
> end
>
>
> *** ivreg2 results stacked togehter
> sysuse auto, clear
> ivreg2 price headroom trunk (mpg=rep78 foreign), savefirst first
> est store _ivreg2_price
> ivreg2out _ivreg2_mpg _ivreg2_price
> outreg2 using myfile, replace long nor2 adds("r2 first", e(r2_1), "r2 second", e(r2_2))
>
> *** ivreg2 results not-so stacked togehter
> sysuse auto, clear
> ivreg2 price headroom trunk (mpg=rep78 foreign), savefirst first
> est store _ivreg2_price
> ivreg2out _ivreg2_mpg _ivreg2_price
> outreg2 using myfile, replace nor2 adds(r2, e(r2_1)) eqkeep(mpg)
> outreg2 using myfile, nor2 adds(r2, e(r2_2)) eqkeep(price)
>
>
>
> *** these are for the future reference (non-stacked)
>
> * from stored estimates
> sysuse auto, clear
> ivreg2 price headroom trunk (mpg=rep78 foreign), savefirst first
> est store _ivreg2_price
> outreg2 [*] using myfile, replace see
>
> * cleaner column titles, can be used with ctitie( ) if so desired
> sysuse auto, clear
> ivreg2 price headroom trunk (mpg=rep78 foreign), savefirst first
> est store _ivreg2_price
> est restore _ivreg2_mpg
> outreg2 using myfile, replace
> est restore _ivreg2_price
> outreg2 using myfile, see
>
> * by hand
> sysuse auto, clear
> reg mpg headroom trunk rep78 foreign
> gen esample=e(sample)
> outreg2 using myfile, replace
> ivreg2 price headroom trunk (mpg=rep78 foreign) if esample, savefirst first
> est store _ivreg2_price
> outreg2 using myfile, see
>
>
> _________________________________________________________________
> Windows Live: Make it easier for your friends to see what you’re up to on Facebook.
> http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_facebook:082009
> *
> *   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/



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