--- Nuno Soares wrote:
> I'm running a OLS using the -regression- and -statsby- commands in order to
> save the results into a dataset. Does anyone knows how to access the t-stats
> and p-values associated with the estimated coefficients?
Stata doesn't store the t-stats or the p-values, but you can get the t-stats if
you know the t-stats are the parameter estimates divided by the standard error,
both of which are stored by -regress-. And once you know the t-stat you can find
the p-value, using the function ttail, see: -help function-. Also see the example
below:
*----------- begin example -----------------
sysuse auto, clear
regress price weight mpg if foreign == 0
regress price weight mpg if foreign == 1
statsby tweight = (_b[weight]/_se[weight]) /*
*/ pweight = (2 * ttail(e(df_r), abs(_b[weight]/_se[weight]))) /*
*/ tmpg = (_b[mpg]/_se[mpg]) /*
*/ pmpg = (2 * ttail(e(df_r), abs(_b[mpg]/_se[mpg]))) /*
*/, by(for): regress price weight mpg
list
*----------- end example ------------------
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/