Some Questions on Estimation and Forecasting with Dynare Julia

Hi everyone,

First of all, a big ‘thank you’ to everyone involved in the dynare-julia project, everything I’ve tried so far works very well and the speed gains over Matlab are very impressive.

I had a few questions when using it for simple estimation and forecasting tests.

  1. Is it possible to incorporate the parameters in a seperate file, as it was possible in Matlab to do something like: @#include “parameter_file.m”.

  2. Is it possible to have a seperate file to compute the steady state, as it was possible in Matlab to have a file like “model_steadystate” starting with:

function [ys,params,check] = model_steadystate(ys,exo,M_,options_)
%
% Inputs: 
%   - ys        [vector] vector of initial values for the steady state of
%                   the endogenous variables
%   - exo       [vector] vector of values for the exogenous variables
%   - M_        [structure] Dynare model structure
%   - options   [structure] Dynare options structure

etc

  1. When running the estimation command, I noticed that there are no mode_check plots, and the ‘bayesian_irf’ option seems not there yet. Is the plan to add this later? Or is it already there and I just overlooked it, failed to activate the option properly?

  2. When running the forecast! function, I managed to get it running for the calibsmoother, but this seems to always produce a forecast based on the calibrated paramaters, not based on the estimated parameters. How could one produce forecasts based on the estimated parameters?

  3. Is there a way to get confidence bands for the forecasts? Or is this not ready yet? [I guess one alternative would be to just sample from the chain and run the calibsmoother based forecast, using a sampled parameter vector each time]

Thank you so much!

%%%%%%%%%%%%%%%%%%

PS: Here is the example code I have been using (which is based on what people wrote in the forum in recent weeks).

var Y C K L A R W I OBS_C;
varexo eps_A;
parameters alph betta delt gam pssi rhoA sigmA;

alph = 0.35; betta = 0.99; delt = 0.025; gam = 1; pssi = 1.6; 
rhoA = 0.9226; sigmA=0.0440;

model;		
  #UC  = gam*C^(-1);
  #UCp = gam*C(+1)^(-1);
  #UL  = -pssi*(1-L)^(-1);
  UC = betta*UCp*(1-delt+R);
  W = -UL/UC;
  K = (1-delt)*K(-1)+I;
  Y = I+C;
  Y = A*K(-1)^alph*L^(1-alph);
  W = (1-alph)*Y/L;
  R = alph*Y/K(-1);
  log(A) = rhoA*log(A(-1))+eps_A;
  OBS_C=log(C)-log(C(-1));
end;

steady_state_model;
  A = 1;
  R = 1/betta+delt-1;
  K_L = ((alph*A)/R)^(1/(1-alph));
  W = (1-alph)*A*K_L^alph;
  I_L = delt*K_L;
  Y_L = A*K_L^alph;
  C_L = Y_L-I_L;
  L = gam/pssi*C_L^(-1)*W/(1+gam/pssi*C_L^(-1)*W);
  C = C_L*L;
  I = I_L*L;
  K = K_L*L;
  Y = Y_L*L;
  OBS_C=C-C;
end;

shocks;
  var eps_A; stderr sigmA;
end;

steady;
check;

stoch_simul(order=1);

estimated_params;
//PARAMETER     ,  INITIAL VALUE ,  PRIOR TYPE     ,  PRIOR MEAN  ,  PRIOR STDERR  
  rhoA          ,  0.9226        ,  beta_pdf       ,  0.9         ,  0.1           ;
  stderr eps_A  ,  0.0440        ,  inv_gamma_pdf  ,  0.1         ,  0.1           ;
end;

varobs OBS_C;

estimation(order=1,
           datafile='dataset_mj.csv', 
           mh_nblocks=4,
           mh_replic=10000,
           mh_jscale=20.); 

forecasting!(periods=10, datafile="dataset_mj.csv", forecast_mode=calibsmoother);
%forecasting!(periods=10, datafile="dataset_mj.csv", forecast_mode=histval); % does not work

% mode_check,  % does not work
% bayesian_irf % does not work

dataset_mj.csv (1.6 KB)

Yes, @#include works as in Dynare Matlab/Octave

It is a very inefficient way of computing the steady-state (because of back and forth between vectors and symbol names) and it is error prone. I would much prefer making sure that the steady state solver provided by Dynare be up to the task. Can you please provide me with an example where you prefer having a separate steady state file in (Matlab or Julia)?

It’s on my TODO list

It’s on my TODO list

It’s on my TODO list

Thank you very much for your interest in DynareJulia

It is a very inefficient way of computing the steady-state (because of back and forth between vectors and symbol names) and it is error prone. I would much prefer making sure that the steady state solver provided by Dynare be up to the task. Can you please provide me with an example where you prefer having a separate steady state file in (Matlab or Julia)?

This caught my attention Michel – is this a problem especially in, say, Bayesian estimation?

Right. You need to recompute the steady state every time that you evaluate the likelihood. Typically hundreds of time for mode optimization but hundred thousands of time for MCMC. So you want it as efficient as possible or you need to be extremely patient

1 Like

Yes, but the time spent in steady state files typically pales compared to e.g. the Kalman filter.

1 Like