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: outreg- including Heckman estimation results


From   John Luke Gallup <[email protected]>
To   [email protected]
Subject   Re: st: outreg- including Heckman estimation results
Date   Tue, 5 Mar 2013 19:46:30 -0800

Suryadipta,

You are correct that you can include the AIC or BIC statistics using the -addrows- option of -outreg-.  The reason your code below doesn't work is that the AIC statistic is not stored in e(AIC) by -estat ic-.  Instead, it is stored (rather awkwardly) in the matrix r(S).  If the AIC statistic were stored in e(AIC), you could have included it to your -summstat- option. 

You cannot access individual elements of r() matrices, so it is necessary to copy r(S) into a regular Stata matrix.  From there I put the AIC statistic in the local variable "AIC".  The "display" in -local AIC : display ...- applies a 1 decimal place format on the value of AIC.  The code below does the job:

tobit depvar `controls'  , ll(0)
estat ic
mat es_ic = r(S)
local AIC : display %4.1f es_ic[1,5]
outreg, summstat(N \ r2_p \ ll ) ///
	summtitle(# of observations \ Pseudo R-squared \ log-likelihood ) ///
	addrows("AIC", "`AIC'")

You could access the BIC statistic with the following command:
local BIC : display %4.1f es_ic[1,6]

John

On Mar 5, 2013, at 10:15 AM, Suryadipta Roy <[email protected]> wrote:

> I had a related query as to whether it is possible to obtain the AIC/
> BIC test statistics using the -addrows- option after -outreg- . For
> example, I have been running the following commands but have not been
> able to obtain the AIC or the BIC result on the table. I would very
> much appreciate some help to get this right.
> 
> tobit depvar `controls'  , ll(0)
> estat ic
> outreg, summstat(N \ r2_p \ ll ) summtitle(# of observations \ Pseudo
> R-squared \ log-likelihood ) addrows("AIC", "`e(AIC)'") merge
> 
> Any help is greatly appreciated.
> 
> Sincerely,
> Suryadipta.
> 
> On Sun, Mar 3, 2013 at 2:02 AM, John Luke Gallup <[email protected]> wrote:
>> Suryadipta,
>> 
>> You have found a bug, which only occurs when you use the -keep- option of -outreg- in a multi-equation estimation (like -heckman-) and then use the -eq_merge- option.  I had never tried this combination before.
>> 
>> Until I fix the underlying bug, you can get around the problem by changing -keep(var1 var2 var3)- in the -heckman- command to -keep(ln_var:var1 var2 var3 depvar:var1 var2 var3)-.
>> 
>> John
>> 
>> On Mar 1, 2013, at 3:37 PM, Suryadipta Roy <[email protected]> wrote:
>> 
>>> Dear Statalisters,
>>> 
>>> I am using -outreg- to create estimation tables of my regressions.
>>> However, there seems to be a huge proliferation of columns following
>>> -heckman- , and I was wondering if someone can help with getting it
>>> right. My commands are as follows:
>>> 
>>> tobit ln_var `controls', ll(0) vce(cluster pair)
>>> 
>>> outreg using mytables, bdec(2) squarebrack keep(var1 var2 var3)
>>> starlevels(10 5 1) sigsymbols(+,*,**) summstat(N \ r2_p) summtitle(#
>>> of observations \ Pseudo R-squared) ctitle("", Tobit model)
>>> note(Cluster robust standard errors in brackets) merge /* this creates
>>> the first column with the tobit regression results */
>>> 
>>> probit depvar `controls' selection_var , vce(cluster pair)
>>> 
>>> outreg using mytables, bdec(2) squarebrack keep(var1 var2 var3)
>>> starlevels(10 5 1) sigsymbols(+,*,**) summstat(N \ r2_p) summtitle(#
>>> of observations \ Pseudo R-squared) ///
>>> ctitle("", Probit model) merge replace /* this creates the second
>>> column with the probit regression results followed by */
>>> 
>>> reg ln_var `controls' if depvar==1, vce(cluster pair)
>>> 
>>> outreg using mytables, bdec(2) squarebrack keep(var1 var2 var3)
>>> starlevels(10 5 1) sigsymbols(+,*,**) summstat(N \ r2_a) summtitle(#
>>> of observations \ Adjusted R-squared) ///
>>> ctitle("", Two-part lognormal model) merge replace /* this creates the
>>> third column with the lognornam regression results of the two-part
>>> model*/
>>> 
>>> However, the problem arises when I run -heckman- next and tries to
>>> creates two columns of results for the outcome and the selection
>>> variables.
>>> 
>>> heckman ln_depvar `controls' , select(depvar = `controls'
>>> selection_var ) twopart
>>> /* using outreg to add two columns */
>>> outreg using mytables, bdec(2) eq_merge squarebrack keep(var1 var2
>>> var3) starlevels(10 5 1) sigsymbols(+,*,**) summstat(N, N) summtitle(#
>>> of observations) ctitles("", Heckman Outcome equation, Heckman
>>> Selection equation) merge replace
>>> 
>>> I believe that there is a mistake in the last command, and I would
>>> very much appreciate some suggestions in this regard.
>>> 
>>> Sincerely,
>>> Suryadipta.
>>> *
>>> *   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