On Wedmesday, Dejan wrote:
> I did regressions over the huge set of data and would like to have
> betas and reg. coefficients placed in the "data browser" window what I
> managed to do using eclass command such as ereturn list and save it as
> matrix, but I have a problem to do the same thing with the p>t values
> as I cannot extract it from ereturn list
The test statistics and p-values are not in the saved results since they
can be calculated from the coefficients and the standard errors.
Here is an example of how to save the coefficients and standard errors
into a dataset and then calculate test statistics, p-values and
confidence intervals from them:
clear
sysuse auto
regress mpg len turn head gear
qui{
drop _all
mat b=e(b)'
mat se= vecdiag(cholesky(diag(vecdiag(e(V)))))'
gen vars=""
local names: rownames b
tokenize `names'
local num : word count `names'
set obs `num'
forvalues i=1/`num'{
replace vars= "``i''" in `i'
}
svmat b
svmat se
rename b1 coef
rename se1 se
gen t=coef/se
gen pvalue=2*ttail(e(N),abs(t))
gen lb=coef-invttail(e(N),0.025)*se
gen ub=coef+invttail(e(N),0.025)*se
}
list
--May
[email protected]
*
* 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/