Estimating a DSGE Model and want to check RMSE for model evaluation


#1

Dear Everyone

I was estimating a dsge model with bayesian estimation. I was wondering how do I get the RMSE so that evaluate the forecasting performance of the model.

Thank you


#2

In your .mod you can use option nobs = [30:55], where 30 is size of sample initial and 55 is total number of data. And also you need to use forecast = 12, in order to forecast 12 periods.

After that, you can run some code similar to this

load('nameofyourmod_results.mat')
DataBase = xlsread('my_dataxls');
[nDataTot, nVobs] = size(DataBase);
nDataInit = 30; % la primera muestra tiene 30 datos
hzte = 12; % 
nDataCompare = nDataTot-(nDataInit+hzte)+1;
DataToCompare = zeros(hzte,nVobs,nDataCompare);

for i = 1:nDataCompare   
    DataToCompare(:,:,i) = DataBase(nDataInit+i:nDataInit+i+hzte-1,:);
end

% -------------------------------------------------------------------------
% Armando datos proyectados desde DSGE
DataForecastDSGE = zeros(hzte,nVobs,nDataCompare);
for i = 1:nDataCompare
    newi = nDataInit+i-1;
    DataForecastDSGE(:,:,i) = [oo_recursive_{1, newi}.PointForecast.Mean.R_obs, ... 
                               oo_recursive_{1, newi}.PointForecast.Mean.dy_obs, ...
                               oo_recursive_{1, newi}.PointForecast.Mean.de_obs, ...
                               oo_recursive_{1, newi}.PointForecast.Mean.infl_obs];
end


% -------------------------------------------------------------------------
eamDSGE = zeros(hzte,3);
recmDSGE = zeros(hzte,3);
for i = 1:hzte 
    for j = 1:nVobs
            e = squeeze(DataToCompare(i,j,:)) - squeeze(DataForecastDSGE(i,j,:));
            eamDSGE(i,j) = mean(abs(e));
            recmDSGE(i,j) = sqrt(e'*e/length(e));  
    end
end

When you use this, Don’t forget that order of variables in excel should be are acording to [R_obs, dy_obs, de_obs, infl_obs]. It is because you will need to compare your excel data versus forecasts