Page 1 of 1

mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Fri Jun 19, 2015 10:30 am
by mharding
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:

Code: Select all
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

Code: Select all
Error using chol
Matrix must be positive definite.


for mode_compute=9:

Code: Select all
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.

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Sat Jun 20, 2015 8:50 pm
by jpfeifer
Please try the unstable version and report back.

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Tue Jun 23, 2015 6:23 am
by mharding
Dear Johannes,

thank you. With the unstable version the problem is solved for both estimation at first and second order. Using mode_compute=9, the computing time for the particle filter is of 9h32min (with an Intel Core i7-4600U, 2.7GHz, 64-bit and 4GB RAM). Now I'm dealing with the problem that the hessian is not positive definite at the mode, but I suppose I should find suitable values for a positive definite hessian at fisrt order, and then try at second order.

Thank you again for your help.

Martin

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Thu Jun 25, 2015 6:18 pm
by jpfeifer
Yes. Or try the
Code: Select all
mcmc_jumping_covariance
option with the Hessian from first order.

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Wed Jul 08, 2015 6:20 am
by mharding
Thank you Johannes.

Another issue: the acceptance rate of the MCMC remains extremely low, it doesn't matter how low I set the mh_jscale value. Hence, the algorithm tends to get stuck in some subspace of the parameter space. Any idea on how to increase the acceptance rate?

And one follow up question regarding mode_check plots: can they be interpreted just as with the Kalman filter? As can be seen from the pdfs attached, the likelihood appears to jump up and down in this case rather than behave smoothly.

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Wed Jul 08, 2015 7:07 am
by jpfeifer
Dear Martin, the mode-file is missing.

Regarding mode_check: in principle the interpretation is the same, but in case of the particle filter, the likelihood function is not differentiable anymore as different parameters might result in different particles being selected. This explains the random chatter.

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Wed Jul 08, 2015 9:14 am
by mharding
Dear Johannes,
thank you. Here is the mode-file and the MCMC jumping covariance matrix that I'm using, which is the hessian at first order (I converted the files to .xls since the .mat format apparently is not supported for uploading).

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Wed Jul 08, 2015 10:06 am
by jpfeifer
Please provide the mat-file in a zip-file.

Re: mode_compute=6 ; 9 : index exceeds matrix dimensions

PostPosted: Wed Jul 08, 2015 11:34 am
by mharding
OK, yes that's better. Here they are.