I am using a Matlab toolbox for obtaining one-step ahead forecasts of the conditional mean from the ARMA(1,0)-GARCH(1,1) process and I have encountered a piece of code that contains, in my opinion, a mistake. The full code of the forecasting function is available for viewing at: http://uk.mathworks.com/matlabcentral/fileexchange/32882-armax-garch-k-toolbox--estimation--forecasting--simulation-and-value-at-risk-applications-/content/garchfor.m
The fragment that I was referring to is:
% Forecasting the Mean MF = parameters(1:1+z)'*[1; data(end-(1:ar)); resids(end-(0:ma-1))]; % 1-period ahead forecast for i = 2:max_forecast MF(i,1) = sum([parameters(1); ones(1,ar)*parameters(2:2+ar)*MF(i-1,1); ones(1,ma)*parameters(3+ar:2+ar+ma)*resids(end-(0:ma-1-i))]); end clear i
From this code it seems that when I am considering ARMA(1,0) the function takes the one before last observation for the forecast. In other words, when the data spans time points $1,...,t$ and I want to obtain a forecast for period $t+1$ I multiply the AR(1) coefficient by the $t-1$ observation.In my opinion, for time $t+1$ AR(1) forecast I should be taking the last observation ($t$) from the data-set and multiply it by the AR(1) coefficient.
Could you please confirm my suspicions about this piece of code?