[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: p>t value extraction
> 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.
Stata provides all the information you need to compute the "p-values" yourself. The p-values are the significance levels at which you would reject the null hypothesis (beta=0) from the t-test, which is no more than your parameter divided by the standard error. You have already found the matrix of parameters (e(b)). the variance-covariance matrix is stored in e(V), the diagonal are the variances. These can be extracted using -vecdiag- taking the square root of these will produce the standard errors. All you have to do now is devide the parameters by the standard error and let stata look the p-values up in a t-table (using -ttail(degrees of freedom, t-value)-). The appropriate degrees of freedom are the number of observations minus the number of explanatory variables minus 1. Below is an example using the well known auto dataset. Cut those between begin example and end example and paste them in the do-file editor and run.
sysuse auto, clear
reg price mpg rep78 headroom trunk weight
matrix a = vecdiag(e(V))
matrix b = (e(b)\a)'
rename b1 beta
gen se = sqrt(b2)
gen t = beta/se
gen p = ttail(63,t)
Hope this helps,
* For searches and help try: