Page 1 of 1

error message in computing filtered variables

PostPosted: Fri Aug 10, 2007 6:34 am
by iacoviel
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

PostPosted: Fri Aug 10, 2007 6:48 am
by MichelJuillard
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

Re: error message in computing filtered variables

PostPosted: Wed Aug 08, 2012 7:23 pm
by AnitaYang
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.

Re: error message in computing filtered variables

PostPosted: Fri Aug 10, 2012 1:21 pm
by SébastienVillemot
Which version of Dynare are you using?

Also, please post you MOD-file.

Re: error message in computing filtered variables

PostPosted: Fri Sep 07, 2012 4:00 am
by AnitaYang
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.

Re: error message in computing filtered variables

PostPosted: Sun Mar 10, 2013 1:25 pm
by jpfeifer
This looks like a bug. With Dynare 4.3.2 it runs on my machine.

Re: error message in computing filtered variables

PostPosted: Fri Apr 12, 2013 10:09 pm
by zere00
I also have exactly the same error with my code (using version 4.3.0) and after changing to 4.3.2 it worked.