mae {MSBVAR} | R Documentation |
Computes the mean absolute error of VAR forecasts
mae(m1, m2)
m1 |
nstep x m matrix of VAR forecasts |
m2 |
nstep x m matrix of VAR forecasts or true values |
Computes the mean absolute error (MAE) across a series of VAR forecasts.
MAE value
Patrick T. Brandt
data(IsraelPalestineConflict) Y.sample1 <- window(IsraelPalestineConflict, end=c(2002, 52)) Y.sample2 <- window(IsraelPalestineConflict, start=c(2003,1)) # Fit a BVAR model fit.bvar <- szbvar(Y.sample1, p=6, lambda0=0.6, lambda1=0.1, lambda3=2, lambda4=0.25, lambda5=0, mu5=0, mu6=0, prior=0) # Forecast -- this gives back the sample PLUS the forecasts! forecasts <- forecast(fit.bvar, nsteps=nrow(Y.sample2)) # Compare forecasts to real data mae(forecasts[(nrow(Y.sample1)+1):nrow(forecasts),], Y.sample2)