Manipulating estimated coefficients
Posted: Tue Jun 05, 2012 5:58 am
Hi,
I made a expanding window forecast for the stock return(exstock) against (yspr(-1)). Now what i want is: if the estimation coefficient is positive we keep it and when it is negative we set it to zero for the recursive forecast, so that there will be no forecast power. In this way, we can reduce the prediction error if we know the parameter should have a certain sign. I want to do this through a if command? And how do we specify the coeficient to be 0?
Thanks
for !i = 1 to !length-!window+1-!step step !step
' set sample to estimation period
smpl @first @first+!i+!window-2
' estimate equation
eq1.ls exstock c yspr(-1)
' reset sample to forecast period
smpl @first+!i+!window-1 @first+!i+!window-2+!step
' make forecasts in temporary series first
eq1.forecast(f=na) tmp_yhat tmp_se
' copy data in current forecast sample
yhat = tmp_yhat
yhat_se = tmp_se
next
I made a expanding window forecast for the stock return(exstock) against (yspr(-1)). Now what i want is: if the estimation coefficient is positive we keep it and when it is negative we set it to zero for the recursive forecast, so that there will be no forecast power. In this way, we can reduce the prediction error if we know the parameter should have a certain sign. I want to do this through a if command? And how do we specify the coeficient to be 0?
Thanks
for !i = 1 to !length-!window+1-!step step !step
' set sample to estimation period
smpl @first @first+!i+!window-2
' estimate equation
eq1.ls exstock c yspr(-1)
' reset sample to forecast period
smpl @first+!i+!window-1 @first+!i+!window-2+!step
' make forecasts in temporary series first
eq1.forecast(f=na) tmp_yhat tmp_se
' copy data in current forecast sample
yhat = tmp_yhat
yhat_se = tmp_se
next