Years ago I wrote three matlab files that allow to condition the DSGE forecasts on given future paths for a subset of endogenous variables. For instance:

Here is a(somewhat stupid)n example with a two country model where we constrain the paths of the nominal interest rates in the US and the Euro Area and the path of the nominal exchange rate. After the estimation command the user has to declare (i) the constrained endogenous variables, (ii) the shocks used to control the paths of these endogenous variables, (iii) the paths of the constrained endogenous variables, (iv) the number of periods during which a subset of endogenous variables is constrained, (v) the number of periods for the forecast, (vi) the number of simulations and (vii) the size of the confidence bands.

   //% DECLARATION OF THE CONSTRAINED ENDOGENOUS VARIABLES.
   cV = 'Robs';
   cV = strvcat(cV,'R_Fobs');
   cV = strvcat(cV,'NEER');

   //% DECLARATION OF THE EXOGENOUS VARIABLES USED TO CONTROL THE PATHS OF THE VARIABLES IN cV.
   //% NOTE: The ordering of the variables should not matter. 
   cS = 'E_R';
   cS = strvcat(cS,'E_R_F');
   cS = strvcat(cS,'E_NEER');

   //% DECLARATION OF THE PATHS FOR THE VARIABLES IN cV. 
   mcValue = zeros(size(cV,1),1);
   mcValue(1,1) = oo_.SmoothedVariables.Robs(end);
   mcValue(2,1) = oo_.SmoothedVariables.R_Fobs(end);

   cL = 8;            //% LENGTH OF THE CONSTRAINED PATH.
   H  = 40;           //% NUMBER OF PERIODS FOR THE FORECAST. 
   B  = 10000;        //% NUMBER OF SIMULATIONS.
   ci = .80;          //% SIZE OF THE CONFIDENCE BANDS AROUND THE FORECASTS.

   imcforecast('mode',cV,cS,cL,H,mcValue,B,ci)  

Remark 1. In the third block, the paths are not declared for the eight periods but only for the first period (the nominal exchange rate -- in deviation to its steady state level -- is constrained to be zero, the nominal interest rates keep constant). By default the routine will assume that the paths are constant over cL periods.

Remark 2. The first argument of imcforecast is 'mode', 'mean' or 'median'. We do not consider the uncertainty on the deep parameters, so the user has to choose a point estimate for structural parameters (the posterior mode, the posterior mean or the posterior median).

Remark 3. Variables in cV and cS must be declared as endogenous variables and exogenous variables in the mod file.

Remark 4. I have never tried to constrain the path of an unobserved endogenous variable, but it should be possible.

How to build the plots?

The function will save the results in a mat file called conditional_forecasts.mat. The user can obtain a plot for each endogenous variable by using the following instruction in the matlab command window:

plot_icforecast('Zobs')

where, in our example, Zobs is the US production.

#class left
attachment:Zobs.jpg