Hi,
I’m trying to do conditional forecast with perfect foresight after estimation. From the manual, I understand that I need to use det_cond_forecast. I follow the example in the manual and define init_plan and flip_plan. However, I couldn’t figure out how to give smoothed variables from the estimation to det_cond_forecast. The example is referring to a csv file. Is the file containing oo_.SmoothedVariables and oo_.SmoothedShocks results?
Thanks,
Baris
Can you provide more information? Which example are you referring to?
Sure, thank you. Here is the example from the manual:
% conditional forecast using extended path method
% with perfect foresight on r path
var y r;
varexo e u;
…
smoothed = dseries(‘smoothed_variables.csv’);
fplan = init_plan(2013Q4:2029Q4);
fplan = flip_plan(fplan, ‘y’, ‘u’, ‘surprise’, 2013Q4:2014Q4, [1 1.1 1.2
˓→1.1 ]);
fplan = flip_plan(fplan, ‘r’, ‘e’, ‘perfect_foresight’, 2013Q4:2014Q4,
˓→[2 1.9 1.9 1.9 ]);
dset_forecast = det_cond_forecast(fplan, smoothed);
plot(dset_forecast.{‘y’,‘u’});
plot(dset_forecast.{‘r’,‘e’});
Hi,
I wanted to follow up on this. Does anyone know which smoothed variables we need to give to det_cond_forecast?
Best,
Baris
@stepan-a may know the answer. An example file is at tests/conditional_forecasts/5/fs2000_cal.mod · master · Dynare / dynare · GitLab
My guess is that you should create a dseries
from the smoothed shocks and variables. It should contain all of them.
This is great! Thank you very much.
I have another question now. I was expecting to get the same results when I use conditional_forecast and flip_plan with the ‘surprise’ shock. I give the same constrained path to the same endogenous variable and specify the same exogenous variable as control. However, conditional_forecast.cond.Mean results are different than det_cond_forecast results. Do you know why this is the case?
Best and thanks again,
Baris
Could you please provide me with the files to replicate the issue?
I was working on the file example file you shared yesterday. I added conditional_forecast before the extended path simulation.
simulation.mod (2.7 KB)
Hi,
I wanted to follow up on this and add another question. When I create the dseries from steady state values, det_cond_forecast runs smoothly. However, when I give smoothed variables and shocks to dseries after estimation, I get the following error:
Error using bytecode
Fatal error in bytecode: in Simulate_Newton_Two_Boundaries, the initial values of endogenous variables are
too far from the solution.
Change them!
Error in det_cond_forecast (line 164)
[endo, exo] = bytecode(‘extended_path’, plan, oo_.endo_simul, oo_.exo_simul, M_.params, oo_.steady_state, options_.periods);
Error in estimation.driver (line 3273)
f = det_cond_forecast(fplan, f, frng);
Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);
Is there a way to start conditional forecast under perfect_foresight from last smoothed variable?
Thanks,
Baris
Dear all,
For some reason the shock types “perfect_foresight” and “surprise” yield the same results for the basic_plan and the flip_plan simulations using det_cond_foresight.
In particular, it seems that det_cond_foresight always computes the “surprise” forecast regardless of what is specified in basic_plan or flip_plan. Please see the file attached.
Is this a bug or did we miss something?
Thank you so much!
Best,
Christian
simulation.mod (2.5 KB)