Code:
// data sysuse auto, clear // interaction model 1 regress price c.mpg##c.mpg##foreign estimates store interaction1 // interaction model 2 gen mpg_mpg_foreign = mpg*mpg*foreign gen mpg_mpg = mpg*mpg gen mpg_foreign = mpg*foreign regress price mpg mpg_mpg foreign mpg_foreign mpg_mpg_foreign * store estimation results in matrix b mat b=e(b) * access all colnames in the matrix b local colnames: colnames b * substitute particular string in colnames list local colnames : subinstr local colnames "mpg_mpg" "c.mpg#c.mpg", all local colnames : subinstr local colnames "mpg_foreign" "foreign#c.mpg", all * local colnames : subinstr local colnames "foreign " "1.foreign", all * rename matrix colnames with new local list matrix colname b = `colnames' * replace all estimates with erepost package capt prog drop replace_b program replace_b, eclass erepost b= b, rename end replace_b estimates store interaction2 // make table esttab interaction1 interaction2, nobaselevels esttab interaction1 interaction2, nobaselevels label
Thank you so much.
0 Response to Show estimates for identical variables next to each other (e.g. via esttab)
Post a Comment