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:

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[/size]

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:

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.

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.

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,RQtranspose®,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. version2_FB_nlin_est.mod (3.46 KB)