This project is read-only.

Bug in "forecast" function?

Jul 1, 2015 at 9:14 AM

I'm struggling with the behavior of the forecast command after estimating a VAR.
In particular, the forecasts crucially depend on whether I estimate the VAR with or without constants, even though all the VAR variables have zero mean.

The estimated constants (if included) of course slightly differ from zero, but this does not explain the difference in forecasts.
Is there any reason why the long-term forecasts of a VAR model should not converge to their unconditional mean, i.e. their estimated constant?

Please find below an example code replicating my issue.

PS: When I add the option 'deviation',true the forecasts of the VAR with constant are, as one would expect, identical to those of the VAR model without a constant.

x=x-repmat(mean(x,1),100,1); % subtract mean from sample

startHist = mm(2000,1); endHist = startHist+99; histRange = startHist : endHist;

varnames = {'var1','var2','var3','var4'}; M = array2db(x,histRange,varnames);

v1 = VAR(varnames);
[v1,vd1] = estimate(v1,M,Inf, ...

fcast1= forecast(v1,M,endHist+1:endHist+48,'meanOnly=',true);

v2 = VAR(varnames);
[v2,vd2] = estimate(v2,M,Inf, ...
fcast2 = forecast(v2,M,endHist+1:endHist+48,'meanOnly=',true);

plot([fcast1.var1(:) fcast2.var1(:)]); 
hold on;
plot([0 48],[0 0],'Color','black')
hold on;
plot([0 48],[v2const(1) v2const(1)],'Color','red')
legend('forecast 1','forecast 2','zero','uncond. mean')

% these forecasts differ substantially, i.e. while the first forecast (w/o constant) converges to zero, the second forecast (w/ constant) does not converge to its unconditional mean

v3 = VAR(varnames);
[v3,vd3] = estimate(v3,M,Inf, ...
fcast3 = forecast(v3,M,endHist+1:endHist+48,'meanOnly=',true,'deviation',true);

plot([fcast1.var1 fcast3.var1])
% these forecasts yield identical results
Jul 1, 2015 at 2:21 PM
Hi Mark

You've made a mistake at this line:
This command retrieves the estimated constant terms, not the unconditional mean of the VAR process. These two obviously differ from each other (unless the transition matrix is all zeros).

If you replace that command line with the following one
and change the v2const to v2mean in the plotting commands, you'll get the results you expect.

Marked as answer by jaromirbenes on 7/1/2015 at 6:21 AM
Jul 1, 2015 at 2:39 PM
Hi Jaromir,

Thank you so much for the quick response, now I got it.

Kind regards,