On Sun, 18 Mar 2012, Allin Cottrell wrote:
On Sat, 17 Mar 2012, Dan Běsoň wrote:
> I am finishing my thesis on volatility prediction and I would like to
> compare 1-step-ahead forecasts of various models [...]
Here are a couple of other variants of "what you might want" from
the forecasting exercise and how to achieve the given effects.
Variable names mostly using the style of Daniel's original script.
<hansl>
open denmark.gdt
series allRR = LRM
# "rolling" 1-step ahead forecast with the sample range
# _augmented_ by one observation at each iteration
ols allRR allRR(-1) allRR(-2) allRR(-3) --robust --quiet
fcast 1986:3 1987:3 1 rollfcast --rolling
print rollfcast --byobs
# "rolling" 1-step ahead forecast with the sample range
# pushed forward by one observation at each iteration
# (i.e. the last observation is dropped when a new one
# is added)
scalar DataLen = $nobs
scalar FirstObs = 1
scalar LastObs = 50
matrix fcvals = zeros(5,1)
j = 1
loop t = LastObs + 1..DataLen - 1 --quiet
smpl FirstObs LastObs
ols allRR allRR(-1) allRR(-2) allRR(-3) --robust --quiet
fc1 = LastObs + 1
fcast fc1 fc1 --quiet
fcvals[j] = $fcast
FirstObs++
LastObs++
j++
endloop
printf "\n%12.5f\n", fcvals
</hansl>
Allin Cottrell