I have got a question on adding star after coefficient in the matrix output of a regression. Below are the code and output.
Code:
set trace on
version 15.1
clear
sysuse auto.dta
local outcome price mpg headroom
local k = 1
foreach var of varlist `outcome' {
qui reg `var ' i.foreign, robust
mat b_`k' = r(table)
mat b_`k' = (b_`k'[1, 2..3] \ b_`k'[4, 2..3])'
local lbl_var: var label `var'
mat colnames b_`k' = "`lbl_var'" "`lbl_var'_pvalue"
local val_lbls
local val_lbl: label(foreign) 1
local val_lbls `" `val_lbls' "`val_lbl'" "'
local val_lbls `" `val_lbls' "The Constant" "'
macro list _val_lbls
mat rownames b_`k' = `val_lbls'
local k = `k' + 1
}
mat final = b_1
forvalues k = 2/3 {
mat final = final, b_`k'
}
mat list finalCode:
final[2,6]
Price Price_pvalue Mileage(mpg) Mileage (m~e Headroom (~) Headroom (~e
Foreign 312.25874 .65768953 4.9458042 .0020303 -.54020979 .00150673
The Constant 6072.4231 2.258e-22 19.826923 1.881e-42 3.1538462 6.313e-37Now, the question is that, since I manually add these values to this matrix, there is no star after each coefficient show if this is statistically significant. Ideally, I hope I could add stars to each coefficient. It will be like, if p-value is less than 0.01, then there will be three stars in the top right corner of that coefficient. I need to use a matrix here for later, so I cannot use outreg2 or esttab.
Does anyone happen to know how to achieve this?
Thanks a lot!
0 Response to How to add star to show the significance of standard error in regression matrix output
Post a Comment