Hi,
I am trying to make my code more flexible using macro varlist since I would like to use various combinations of independent variables. Here is an example of what I'm trying to do:
In this case the independant variables are: spxadj irx. I would like to incorporate the following in a way that I can calculate the prediction "ibmadj_hat":
Is there an easy way to do that? Thanks!
I am trying to make my code more flexible using macro varlist since I would like to use various combinations of independent variables. Here is an example of what I'm trying to do:
Code:
use http://www.stata-press.com/data/r13/ibm, clear tsset t generate ibmadj = ibm - irx generate spxadj = spx - irx sort date save ibm.dta, replace rolling _b, window(200) saving(betas, replace) keep(date): regress ibmadj spxadj irx use betas.dta, clear merge 1:1 date using ibm.dta, keepusing(ibmadj spxadj irx) * Calculate the predition: gen ibmadj_hat = _b_cons+spxadj*_b_spxadj+irx*_b_irx
Code:
local dep ibmadj local index spxadj irx