error message in computing filtered variables

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.

error message in computing filtered variables

Postby iacoviel » Fri Aug 10, 2007 6:34 am

I have a model where the total number of variables and number of observations is quite large (around 90). Everything is fine during estimation, but if I include the option filtered_vars I get the following error:


??? Subscripted assignment dimension mismatch.

Error in ==> metropolis at 1697
stock_filter(:,:,irun_filt) = filtered_state_vector;

Error in ==> dynare_estimation at 824
metropolis(xparam1,invhess,gend,data,rawdata,bounds);

Error in ==> model1 at 776
dynare_estimation(var_list_);

Error in ==> dynare at 26
evalin('base',fname) ;

Error in ==> kaiser7 at 8
dynare model1.mod


It looks to me as if something is wrong with the size of the filtered_state_vector. Its rows should correspond to the number of variables (N=84) I presume, and its columns to the number of periods I use in estimation in my model (T=93). But somehow the function kalman_transition_matrix.m function gives me nx=109, and I get the error above... In my case, the size of the elements is:

irun_filt=1
MAX_nfilt=17
size(filtered_state_vector)= 109,93
size(stock_filter)=84,93,17

Am I doing something patently wrong? Thanks
iacoviel
 
Posts: 38
Joined: Wed Feb 01, 2006 6:25 pm

Postby MichelJuillard » Fri Aug 10, 2007 6:48 am

Hi,

your model must have lags on more than one period and the difference in number of rows must come from there. Dynare should be corrected to handle this case correctly and not return the filtered values of variables lagged by more than one period that mut be introduced in the state vector for the state space representation used by the Kalman filter in that case.

Best

Michel
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Re: error message in computing filtered variables

Postby AnitaYang » Wed Aug 08, 2012 7:23 pm

I'm facing the same issue now. Without "filtered_vars" option in estimation commend, there is no error message. However, when I include "filtered_vars," I get the following error message (after the estimation results are displayed):

Index exceeds matrix dimensions.

Error in pm3 (line 53)
varlist_TeX = char(varlist_TeX,tit_tex(SelecVariables(i),:));

Error in prior_posterior_statistics (line 300)
pm3(endo_nbr,gend,ifil(1),B,'Updated Variables',...

Error in dynare_estimation_1 (line 905)
prior_posterior_statistics('posterior',dataset_);

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

Error in version2_FB_nlin_est (line 308)
dynare_estimation(var_list_);

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


Also, there is no oo_.FilteredVariables.xx generated.
Could someone give me any idea why I get this error message and let me know how I can fix this issue? Thanks so much in advance.
AnitaYang
 
Posts: 13
Joined: Sun Aug 29, 2010 3:30 am

Re: error message in computing filtered variables

Postby SébastienVillemot » Fri Aug 10, 2012 1:21 pm

Which version of Dynare are you using?

Also, please post you MOD-file.
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: error message in computing filtered variables

Postby AnitaYang » Fri Sep 07, 2012 4:00 am

Sorry for the late reply. I've tried to re-write my file again and again, but I still could not get the filtered variables computed.
The latest error message is displayed as follows:

Error using *
Inner matrix dimensions must agree.

Error in DsgeSmoother (line 119)
Pstar = lyapunov_symm(T,R*Q*transpose(R),options_.qz_criterium,options_.lyapunov_complex_threshold);

Error in prior_posterior_statistics_core (line 156)
[alphahat,etahat,epsilonhat,alphatilde,SteadyState,trend_coeff,aK] = ...

Error in prior_posterior_statistics (line 220)
[fout] = prior_posterior_statistics_core(localVars,1,B,0);

Error in dynare_estimation_1 (line 905)
prior_posterior_statistics('posterior',dataset_);

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

Error in version2_FB_nlin_est (line 322)
dynare_estimation(var_list_);

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


I'm using 4.3.0 and I've attached my mode file. Thank you very much.
Attachments
version2_FB_nlin_est.mod
(3.46 KiB) Downloaded 61 times
AnitaYang
 
Posts: 13
Joined: Sun Aug 29, 2010 3:30 am

Re: error message in computing filtered variables

Postby jpfeifer » Sun Mar 10, 2013 1:25 pm

This looks like a bug. With Dynare 4.3.2 it runs on my machine.
------------
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: error message in computing filtered variables

Postby zere00 » Fri Apr 12, 2013 10:09 pm

I also have exactly the same error with my code (using version 4.3.0) and after changing to 4.3.2 it worked.
zere00
 
Posts: 2
Joined: Tue Apr 02, 2013 12:15 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests