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?

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.

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?

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.