i have another question regarding my code.
Code:
set matsize 511
unab y : TOYOTAMOTORTOTRETURNIND-COMMUTUREDEADDELIST280910
local wc : word count `y'
matrix p = J(`wc',3,.)
matrix rownames p = `y'
matrix colnames p = "adjR2" "coef" "p"
matlist p
tempfile coefficients
capture postutil clear
postfile handle coeff using `coefficients'
local i = 1
foreach var of local y {
{
capture noisily reg `var' RenditenTopix PercentageChangeTWEXR if `var'>-9999, robust
if c(rc) ==0 {
matrix p[`i',1] = (1-(1-e(r2))*(e(df_r)+e(df_m))/(e(df_r))), _b[PercentageChangeTWEXR], 2*ttail(e(df_r), abs(_b[PercentageChangeTWEXR]/_se[PercentageChangeTWEXR]))
post handle (_b[PercentageChangeTWEXR])
}
local ++i
}
}
postclose handle
matlist p
preserve
use `coefficients', clear
tabstat coeff, statistics (sum mean)
restore
So my problem is that i want Stata to count the number of coefficients which are <0 and the p-values which are <0.05 (significant at 5% level).
Is that possible?

0 Response to How to count coefficients and p-values of a regression?
Post a Comment