Doing forecast with DSGE model

Hallo everyone

I am doing forecast with a open economy DSGE model. In particular, I run rolling window and I do forecast upto 12-quarter forecasting horizon. Thus, there are 21 windows to re-estimate quarterly.
In each window, I plot the predicted values and actual value in the same figure to check how well the predicted values behave (see 2 PDF files:ForecasteOpenWD19_20_21.pdf (49.5 KB)
ForecastOpenWD1_18.pdf (161.2 KB) )

Accordingly, I find that it seems that four predicted values such as investment, interest rate, employment and output do not behave well in comparision with actual data

I really do not know that happen to these predicted values

I am pretty sure that I have no problem with Bayesian estimation

I am using Dynare 4.4 and upload all my dynare code here Code.zip (55.5 KB)

Can someone have a look at my PDF files and dynare code to help me in this case`?

I would thank you so much indeed in advance

and looking forward to your reply

Could you please try again with Dynare 4.5? The way we handled constants and trends in estimation has changed

Dear Prof. Pfeifer

I try with Dynare 4.5, but it reports the following error such as

Blockquote Initial value of the log posterior (or likelihood): -2366.4684
Warning: Initial SIGMA is, in at least one coordinate, much smaller than the given boundary intervals. For reasonable global search performance SIGMA
should be between 0.2 and 0.5 of the bounded interval in each coordinate. If all coordinates have lower and upper bounds SIGMA can be empty
In cmaes (line 609)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
n=50: (7,15)-CMA-ES(w=[36 24 16 11 7 4 1]%, mu_eff=4.3) on function dsge_likelihood
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: Non-finite fitness range
In cmaes (line 974)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Iterat, #Fevals: Function Value (median,worst) |Axis Ratio|idx:Min SD idx:Max SD
1 , 16 : 2.8205540232581e+06 +(Inf,Inf) | 9.73e+05 | 32:1.2e-03 10:1.2e+03
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Warning: univariate_diffuse_kalman_filter:: There isn’t enough information to estimate the initial conditions of the nonstationary variables
In univariate_kalman_filter_d (line 174)
In dsge_likelihood (line 423)
In cmaes (line 948)
In dynare_minimize_objective (line 364)
In dynare_estimation_1 (line 220)
In dynare_estimation (line 105)
In ausopen (line 1624)
In dynare (line 223)
Error using ausopen_steadystate (line 340)
The steady state calculations of the investment relative prices are not correct…
Error in evaluate_steady_state_file (line 52)
[ys,check] = h_steadystate(ys_init, exo_ss);
Error in evaluate_steady_state (line 212)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, options,steadystate_check_flag);
Error in resol (line 104)
[dr.ys,M.params,info] = evaluate_steady_state(oo.steady_state,M,options,oo,~options.steadystate.nocheck);
Error in dynare_resolve (line 69)
[dr,info,Model,DynareOptions,DynareResults] = resol(0,Model,DynareOptions,DynareResults);
Error in dsge_likelihood (line 252)
[T,R,SteadyState,info,Model,DynareOptions,DynareResults] = dynare_resolve(Model,DynareOptions,DynareResults,‘restrict’);
Error in cmaes (line 948)
fitness.raw(k) = feval(fitfun, arxvalid(:,k), varargin{:});
Error in dynare_minimize_objective (line 364)
[x, fval, COUNTEVAL, STOPFLAG, OUT, BESTEVER] = cmaes(func2str(objective_function),start_par_value,H0,cmaesOptions,varargin{:});
Error in dynare_estimation_1 (line 220)
[xparam1, fval, exitflag, hh, options_, Scale, new_rat_hess_info] =
dynare_minimize_objective(objective_function,xparam1,options_.mode_compute,options_,[bounds.lb
bounds.ub],bayestopt_.name,bayestopt_,hh,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);
Error in ausopen (line 1624)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

But when I run it with Dynare 4.4.3, there is no problem at all

Would you kindly check it for me? here is my full code DynareQ.zip (53.1 KB)

I would thank you so much indeed

With best wishes

The default options for cmaes have been adapted between version for a better global search performance. That is what happens here. Some tested parameters do not work with your steady state file.

%checking that the calculations of the relative prices are consistent
if abs(gammacd/gammacmc-gammamcd) > 1e-9;
   error('The steady state calculations of the consumption relative prices are not correct...');
elseif abs(gammaid/gammaimi-gammamid) > 1e-9;
   error('The steady state calculations of the investment relative prices are not correct...');
end;

is not a proper way to handle exceptions. Do not throw an error, but return the check-argument. See e.g. https://github.com/DynareTeam/dynare/blob/master/examples/NK_baseline_steadystate.m