Dear all,

I have a nonlinear version of a medium-scale DSGE model and I am trying to implement the particle filter triggered by estimation(order=2,…).

For this, I need to use some algorithm like mode_compute=6 or 9. The problem is that when I try these options, (even for etimation at first order) the algorithm crashes with the following error:

for mode_compute=6:

```
Index exceeds matrix dimensions.
Error in dsge_likelihood (line 301)
constant = SteadyState(BayesInfo.mfys);
Error in gmhmaxlik (line 108)
logpo2 = - feval(ObjFun,proposal,varargin{:});
Error in dynare_estimation_1 (line 437)
[xparam1,PostVar,Scale,PostMean] = ...
Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);
Error in CD08_nonlinear_est (line 536)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ;
```

and also for some tries of this algorithm I’ve gotten the widely discussed error

```
Error using chol
Matrix must be positive definite.
```

for mode_compute=9:

```
Index exceeds matrix dimensions.
Error in dsge_likelihood (line 301)
constant = SteadyState(BayesInfo.mfys);
Error in cmaes (line 948)
fitness.raw(k) = feval(fitfun, arxvalid(:,k), varargin{:});
Error in dynare_estimation_1 (line 526)
[x, fval, COUNTEVAL, STOPFLAG, OUT, BESTEVER] =
cmaes(func2str(objective_function),xparam1,H0,cmaesOptions,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);
Error in CD08_nonlinear_est (line 536)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ;
```

I have run several identification tests to check that all parameters are identified, used the use_calibration option for estimated_params_init option, tried different jumping matrices for the mcmc_jumping_covariance option, but nothing seems to work.

Any further suggestions on how to try to overcome this issue (or to implement the particle filter in general) are highly appreciated.

CD08_usdata_filt.xls (34 KB)

CD08_nonlinear_est.mod (11.5 KB)