1
votes

The Stata documentation for esttab says

stats() disables r2(), ar2(), pr2(), aic(), bic(), scalars(), sfmt(), noobs, and obslast.

It's a bit unfortunate!

How can I show the R-Squared and also the result of the test in the following model? I'm using eststo and esttab to store and output the results. It seems I can either call esttab, stats(test) and show the model estimates and the result of the test and the bottom, or call esttab, ar2 and show the R-Squared at the bottom, but can't combine the two.

Is there any workaround for this?

sysuse auto
eststo clear
eststo: quietly regress price weight mpg
quietly test        (_cons=0) (_b[fs]=1)
estadd scalar test=r(p)

esttab, stats(test)

esttab, ar2
2

2 Answers

2
votes

Maybe this works for you:

clear all
set more off

sysuse auto

eststo clear
eststo: regress price weight mpg

test (_cons=0) (_b[weight]=1)

estadd scalar test = r(p)
estadd scalar r = e(r2_a)

esttab, stats(test r, fmt(%8.4f))

This saves the adjusted R^2 [e(r2_a)] returned from regression estimation (a stored result) and uses it within the stats() option. Type help stored results for details.

Note that the esttab command is a wrapper for the estout command, so you may want to read on that too. These commands are available within the ESTOUT user-written module, by Ben Jann at SSC.

0
votes

You can also call stored estimation results within the stats() option directly.

clear all
set more off

sysuse auto

eststo clear
eststo: regress price weight mpg

test (_cons=0) (_b[weight]=1)

estadd scalar test = r(p)

esttab, stats(test r2_a, fmt(%8.4f))