我正在尝试运行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
}
在这方面的任何帮助将不胜感激。