I was wondering if anyone could show me how to use epilogue variables. I already read the instruction in the manual, but it still confuses to me, so I am here to find some help.

Specifically, I wish to obtain the forecasts of a variable that is not defined in the model block. Say, the model includes real GDP growth and GDP deflator growth, and I want to obtain the forecasts of nominal GDP growth, which should be defined in the epilogue. My questions are:

(1) Where should I put this epilogue block? Before or after the estimation command?
(2) According to the Dynare manual, “posterior smoother subdraws can be recycled for computing epilogue variables without rerunning subdraws”, so how could this be done?

The epilogue block creates a function <mymodel>.epilogue_dynamic(M_.params, ds); that requires as input the model parameters and a time series object. Here <mymodel> denotes the name of your mod file.

the following code produces smoothed epilogue variables.

produce a time series object out of your smoothed variables:

ds=dseries();
for j=1:M_.endo_nbr
ds = [ds dseries(oo_.SmoothedVariables.(M_.endo_names{j}), dates('2000Q1'), M_.endo_names{j})];
end

get the augmented time series object including the epilogue variables

ds = <mymodel>.epilogue_dynamic(M_.params, ds);

If you want to recycle posterior subdraws, you need to load the variable stock in file <mymodel>/metropolis/<mymodel>_smooth1.mat.

Variable stock has size [ nendo * T * draws], so, for draw j you can produce the time series object of smoothed variables of draw j: