Particle filter error in estimation

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Particle filter error in estimation

Postby Jesse » Tue May 17, 2016 7:22 am

Dear All,
I have formulated a dsge model using particle filter estimation with order=2, however, when i run it with kalman filter with order=1, it is able to run, however, when i use order=2, the following error occurs:
The rank condition is verified.


You did not declare endogenous variables after the estimation/calib_smoother command.

Estimation using a non linear filter!


ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: You should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):


Error using chol
Matrix must be positive definite.

Error in sequential_importance_particle_filter (line 74)
StateVectorVarianceSquareRoot = chol(ReducedForm.StateVectorVariance)';%reduced_rank_cholesky(ReducedForm.StateVectorVariance)';

Error in non_linear_dsge_likelihood (line 313)
LIK = feval(DynareOptions.particle.algorithm,ReducedForm,Y,start,DynareOptions.particle,DynareOptions.threads);

Error in initial_estimation_checks (line 133)
[fval,junk1,junk2,a,b,c,d] = feval(objective_function,xparam1,DynareDataset,DatasetInfo,DynareOptions,Model,EstimatedParameters,BayesInfo,BoundsInfo,DynareResults);

Error in dynare_estimation_1 (line 157)
oo_ = initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in ThesisNewCode (line 893)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 223)
evalin('base',fname) ;

>>
when i run model_diagnostics(M_,options_,oo_)
the following errors appears:
MODEL_DIAGNOSTICS: The Jacobian of the static model is singular
MODEL_DIAGNOSTICS: there is 9 colinear relationships between the variables and the equations
...
MODEL_DIAGNOSTICS: The presence of a singularity problem typically indicates that there is one
MODEL_DIAGNOSTICS: redundant equation entered in the model block, while another non-redundant equation
MODEL_DIAGNOSTICS: is missing. The problem often derives from Walras Law.
I am wondering anyone could kindly give me some indication about this? Thank you very much. My thesis is about comparing the forecasting performance of kalman filter and particle filter and I need to find a way to run the model using particle filter since my phd thesis submission deadline is approaching. Thank you very much!
The first attachment is the data, the second attachment is my mod file. any suggestions will be helpful! thank you again
Attachments
ThesisNewCode.mod
mod file
(31.48 KiB) Downloaded 90 times
australia_us_data206.zip
data file
(7.25 KiB) Downloaded 99 times
Jesse
 
Posts: 44
Joined: Sat Feb 13, 2016 3:34 pm
Location: Sydney, Australia

Re: Particle filter error in estimation

Postby jpfeifer » Tue May 17, 2016 7:23 pm

You have to more careful here. At first order, scaling your data with 100 is harmless. At order=2, because certainty equivalence does not hold anymore, it screws everything up. Please change this and report back.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Particle filter error in estimation

Postby Jesse » Wed May 18, 2016 5:19 am

Dear Johannes,
Thank you very much for your helpful guidance. I have modified the data by dividing each variable by 100 (the original variable was multiplied by 100).
The new data set is: australia_us_data206trans
The new mod file is: ThesisNewTwoCode.mod
Please refer to the two attachments
I run the mod and still get the following errors:
There are 9 eigenvalue(s) larger than 1 in modulus
for 9 forward-looking variable(s)

The rank condition is verified.


You did not declare endogenous variables after the estimation/calib_smoother command.


Estimation using a non linear filter!

Loading 94 observations from australia_us_data206trans.mat

Restricting the sample to observations 5 to 94. Using in total 90 observations.
Initial value of the log posterior (or likelihood): -100000011.0295
Reference to non-existent field 'ghx'.

Error in non_linear_dsge_likelihood (line 281)
ReducedForm.ghx = dr.ghx(restrict_variables_idx,:);

Error in gmhmaxlik (line 108)
logpo2 = - feval(ObjFun,proposal,varargin{:});

Error in dynare_estimation_1 (line 418)
[xparam1,PostVar,Scale,PostMean] = ...

Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);

Error in ThesisNewTwoCode (line 881)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;

When i run model_diagnostics(M_,options_,oo_)
Dynare says:
model_diagnostic: the Jacobian of the static model is singular
there is 9 colinear relationships between the variables and the equations
...
The presence of a singularity problem typically indicates that there is one
redundant equation entered in the model block, while another non-redundant equation
is missing. The problem often derives from Walras Law.

Thank you again and looking forward to hearing from you.
Kind regards,
Jesse
Attachments
australia_us_data206trans.zip
data
(7.54 KiB) Downloaded 87 times
ThesisNewTwoCode.mod
mod file
(31.49 KiB) Downloaded 93 times
Jesse
 
Posts: 44
Joined: Sat Feb 13, 2016 3:34 pm
Location: Sydney, Australia

Re: Particle filter error in estimation

Postby jpfeifer » Wed May 18, 2016 10:12 am

Please use the newest unstable version.
You did not adjust the prior distribution of the standard errors of shocks after you deleted the multiplication by 100
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Particle filter error in estimation

Postby Jesse » Thu May 19, 2016 11:20 am

Dear Johannes,
Thank you very much for your helpful guidance. It seems the model has improved for Dynare 4.4.3 although still ending in errors, I have divided the standard errors of shocks by 100. Please refer to the attachments for mod file and data file.
For dynare 4.4.3, the model has improved, e.g. runs for a while and gets mode improvement, although ending up in errors.
For unstable dynare, the following errors occurs:
There are 9 eigenvalue(s) larger than 1 in modulus
for 9 forward-looking variable(s)

The rank condition is verified.


You did not declare endogenous variables after the estimation/calib_smoother command.

Estimation using a non linear filter!


ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: You should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):


Error using chol
Matrix must be positive definite.

Error in sequential_importance_particle_filter (line 74)
StateVectorVarianceSquareRoot = chol(ReducedForm.StateVectorVariance)';%reduced_rank_cholesky(ReducedForm.StateVectorVariance)';

Error in non_linear_dsge_likelihood (line 313)
LIK = feval(DynareOptions.particle.algorithm,ReducedForm,Y,start,DynareOptions.particle,DynareOptions.threads);

Error in initial_estimation_checks (line 133)
[fval,junk1,junk2,a,b,c,d] = feval(objective_function,xparam1,DynareDataset,DatasetInfo,DynareOptions,Model,EstimatedParameters,BayesInfo,BoundsInfo,DynareResults);

Error in dynare_estimation_1 (line 157)
oo_ = initial_estimation_checks(objective_function,xparam1,dataset_,dataset_info,M_,estim_params_,options_,bayestopt_,bounds,oo_);

Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);

Error in ThesisNewFourCode (line 893)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 223)
evalin('base',fname) ;

I also run the model on dynare 4.4.3, it seems the model has improved and runs for a while. however, after some time, the following error appears,

There are 9 eigenvalue(s) larger than 1 in modulus
for 9 forward-looking variable(s)

The rank condition is verified.


You did not declare endogenous variables after the estimation/calib_smoother command.


Estimation using a non linear filter!

Loading 94 observations from australia_us_data206trans.mat

Restricting the sample to observations 5 to 94. Using in total 90 observations.
Initial value of the log posterior (or likelihood): -99999955.7675

==========================================================
Change in the covariance matrix = 14.0625.
Mode improvement = 0
New value of jscale = 3.2639e-05
==========================================================
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.526665e-16.
> In sequential_importance_particle_filter at 152
In non_linear_dsge_likelihood at 322
In gmhmaxlik at 157
In dynare_estimation_1 at 437
In dynare_estimation at 89
In ThesisNewFourCode at 881
In dynare at 180
...
==========================================================
Change in the covariance matrix = 0.085781.
Mode improvement = 3.3776
New value of jscale = 3.4504
==========================================================
...
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.655895e-16.
> In sequential_importance_particle_filter at 152
In non_linear_dsge_likelihood at 322
In gmhmaxlik at 108
In dynare_estimation_1 at 437
In dynare_estimation at 89
In ThesisNewFourCode at 881
In dynare at 180
...
Index exceeds matrix dimensions.

Error in non_linear_dsge_likelihood (line 281)
ReducedForm.ghx = dr.ghx(restrict_variables_idx,:);

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 ThesisNewFourCode (line 881)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;

Thank you very much for your kind help!
Attachments
australia_us_data206trans.zip
data
(7.54 KiB) Downloaded 72 times
ThesisNewFourCode.mod
mod file
(31.58 KiB) Downloaded 89 times
Jesse
 
Posts: 44
Joined: Sat Feb 13, 2016 3:34 pm
Location: Sydney, Australia

Re: Particle filter error in estimation

Postby jpfeifer » Mon May 30, 2016 6:01 am

I cannot even run your mod-file with
Code: Select all
order=1

because the likelihood is complex. Running
Code: Select all
model_diagnostics

returns various collinearity problems. Could you please provide me with a version that runs at
Code: Select all
order=1
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 13 guests