Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Question on the 'new estout'


From   "Herve STOLOWY" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Question on the 'new estout'
Date   Fri, 03 Dec 2004 19:12:52 +0100

Dear Ben (and Statalisters):

I wanted to thank for your help concerning the Nagelkerke R2. I followed
your suggestions and it works.

For those interested, this is the short program which computes the
Nagelkerke R2:

program define _estadd_nagelkerke, eclass
local n=e(N)
local ml=e(ll)
local ml0=e(ll_0)
local k= e(df_m)
local r2_mcfadden = 1 - `ml'/`ml0'
local r2_cox = 1 - exp(-2/`n'* (`ml'-`ml0'))
local nagelkerke = `r2_cox' / (1 - exp(2/`n'*`ml0'))
ereturn scalar nagelkerke = `nagelkerke'

end

I am sure it could be shorter but I wanted to follow the detail of the
computation throughout the Cox and Snell R2.

I also wanted to stress a few points I appreciate in the "new" estout:

- The inclusion of the p-value of the F test (in an OLS regression) or
of the p-value of the Chi2 (in a logit regression) is easier because we
simply need to add it in the "regular" stats with the symbol "p".
- The inclusion of a specific stat (like the Nagelkerke R2) through
estadd is much easier than I anticipated
- I discovered that in the estimates store, it is possible to add a
title. This is really useful and avoids the addition of models' labels
in the estout syntax. Is also shortens the syntax in estout with m1
m2... (if we store the estimates with these short names) instead of the
real (long) name of the model (It was maybe possible before the new
estout but I did not that).

Best regards

Herv�

***********************************************************
HEC Paris
D�partement Comptabilit� Contr�le de gestion / Dept of Accounting and
Management Control
1, rue de la Liberation
78351 - Jouy-en-Josas
France
Tel: +33 1 39 67 94 42
Fax: +33 1 39 67 70 86
[email protected]
http://campus.hec.fr/profs/stolowy/perso/home.htm
>>> [email protected] 12/03/04 9:08 AM >>>
Clive, the program should be:

 program define _estadd_rmse, eclass
   local rmse = sqrt(e(rss)/(e(N) - e(df_m) - e(df_a) -1))
   ereturn scalar rmse = `rmse'
 end

The following would work too: 

 program define _estadd_rmse, eclass
   ereturn scalar rmse = sqrt(e(rss)/(e(N) - e(df_m) - e(df_a) -1))
 end

ben

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Clive Nicholas
> Sent: Friday, December 03, 2004 1:59 AM
> To: [email protected]
> Subject: Re: st: RE: Question on the 'new estout'
> 
> 
> Ben Jann wrote:
> 
> [...]
> 
> > For use with the new version, change the program to
> >
> >  program define _estadd_nagelkerke, eclass
> >    ... [commands calculating nagelkerke] ...
> >    ereturn scalar nagelkerke = `nagelkerke'
> >  end
> >
> > (note that the name of the program starts with "estadd", not
> > "estout"; see -help estadd-) and then type
> >
> >  estadd Balance_sheet Income_statement, stats(nagelkerke)
> 
> [...]
> 
> Following on from Scott Merryman's reply to my last post on 
> calculating
> the root mean square error, I tried the above by running the do-file
> 
> program define _estadd_rmse, eclass
> sqrt(e(rss)/(e(N) - e(df_m) - e(df_a) -1))
> ereturn scalar rmse = `rmse'
> end
> 
> which ran successfuly. However, the next step wasn't so successful:
> 
> . estadd Con Lab LibDem, stats(rmse)
> error executing _estadd_rmse
> r(199);
> 
> What have I done wrong here? Thanks.
> 
> CLIVE NICHOLAS        |t: 0(044)7903 397793
> Politics              |e: [email protected]
> Newcastle University  |http://www.ncl.ac.uk/geps
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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