Questions regarding Baynesian Estimation


I am reading and intrepreting the code by SW(07),
what’s confused me so far is, for the estimation command"estimation(optim=(‘MaxIter’,200),datafile=usmodel_data,mode_compute=0,mode_file=usmodel_mode,first_obs=71,presample=4,lik_init=2,prefilter=0,mh_replic=0,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2);"

1.what does “(optim=(‘MaxIter’,200)” mean exactly?
2. if there are in total 100 observations, but I only want to estimate a subsample of 30-70 observations, does that mean I should speficy in commands as " first_obs=30,nobs=40"?
3. if I wanted to cover the 40-100 observation, would be " fitst_obs=40" be enough ?
4. why do we need Kalman filter exactly? any particular requirements for it?


Answers to:

  1. MaxIter indicates the maximum number of iterations for the optimisation algorithm to search for the optimum.
  2. Yes
  3. Yes, if the data has only 100 observations. Otherwise, you need to specify nobs= xxxx.
  4. In order to evaluate the likelihood function of the state-space model


1 Like

Thanks for your reply.
However, I am still confused with Q4, isn’t it possible for Dynare to evaluate the likelihood function without Kalman filer?

Will the employment of Kalman filter be enhancing the process? or will it help to produce additional results?


There are other ways to compute the likelihood function, but the Kalman filter’s prediction decomposition of the joint likelihood of the observables is usually the most efficient way.

1 Like

Hi, professor,
thanks for your reply.

The reason I am asking this is because I watched the youtube video “dynare3” which started with command (1) “estimation(datafile=data,mode_compute=4,mh_replic=0)” to find the mode;
then implemented the full estimation by the command (2) " estimation (datafile=data, mode_compute=0,mode_file=example_mode,mh_replic=2000,mh_drop=0.1,mh_blocks=2,mh_jscale=0.2)"

without using the Kalman filter at all, does this mean they haven’t computed the likelihood function properly?


  1. Which video are you referring to?
  2. The estimation.command will always rely on the Kalman filter to compute the likelihood. None of the commands above has to do with the filter. What the second command does is the run the Metropolis-Hastings algorithm.

that’s the video

Prof, please signal me the steps of running these codes below?

could I simply run them or I must first set mode_compute=4 (>0) to generate the mode, then set mode_file =example_mode?


unfortunately, the only video online is the one I referred you to, which hasn’t mentioned the Kalman filter at all.

What exactly is it what you are trying to do? I don’t see where the video would be helpful.