を実行してreg、 の係数値を取得しようとしていますStata。私は次のことをしました。が従属y変数 、k、l、が独立変数でありm、私が作成しnた新しい変数があるとします。new
loc vars k l m n
reg y `vars'
# I know that I can get back the coefficients using mat list e(b) but I need to
get coefficient of each variable and use it to compute the elasticity (one at a time).
# so, I run the following loop but it doesn't work.
foreach i in vars {
sca coeff`i' = _b[`i'] # main problem here
sca cons = _b[_cons] # main problem here
corr new `i' , c # correlation of new with each independent vars
sca cov_`i' = r(cov_12)
sum `i'
sca elas_`i' = (coeff`i'*r(mean))/10 # elasticity not working
}
この点でどんな助けも高く評価されます。