Raftery/Lewis test - dimensions of arrays not consistent

Hello, we are trying to do the Raftery/Lewis test with the following option:

estimation(datafile = IN_US_EA,
xls_sheet = US,
mh_replic = 100000,
mode_compute = 5,
raftery_lewis_diagnostics) LY_HAT ;

However, we are getting the following error message:

Error using vertcat
Dimensions of arrays being concatenated are not consistent.

Error in mcmc_diagnostics (line 204)

Error in dynare_estimation_1 (line 425)
oo_= mcmc_diagnostics(options_, estim_params_, M_,oo_);

Error in dynare_estimation (line 105)

Error in TrendCycle_Stationary_Q_US_1.driver (line 388)

Error in dynare (line 310)
evalin(‘base’,[fname ‘.driver’]);

Error in Run_1995_US_1 (line 8)
dynare TrendCycle_Stationary_Q_US_1.mod ;

Please could you give us a hint about what this error is about?



Let me clarify that at the moment we are using Dynare6 unstable; however, when using Dynare5 we do not obtain the results of the Raftery/Lewis test in the command window or in the workspace.

Seems I introduced a bug. Could you provide me with the files to replicate the issue?

Hello Johannes,

Thanks for your reply, I am attaching the files. Actually, let me ask you an additional question, is there a way to get the necessary number of iterations in the Raftery/Lewis test, from oo_. or somewhere else, so that I can run the model for a set of countries?

Thank you very much!

Best regards,


IN.xlsx (9.9 KB)
Model.mod (1.1 KB)
Run_model.m (231 Bytes)

This is a stupid bug. The fix is at Raftery/Lewis: fix case with only one parameter (!2214) · Merge requests · Dynare / dynare · GitLab

Results will be saved in oo_.convergence.raftery_lewis

Hello Johaness, thank you for your response.

We attempted two solutions. First, we downloaded the latest version of Dyanre 6 in hopes of having the updated artifacts there. Second, we downloaded the artifacts and then uploaded them after uploading Dynare6. In both cases the result was the following error message,

“Error using vertcat
Dimensions of arrays being concatenated are not consistent.”

If we run Dynare 5.5 instead, we do not get any error message, but we also do not get the oo_.convergence.raftery_lewis information in the workspace.

Thank you very much


The bug fix will only be in the unstable version once it has been merged. Currently the merge request is still open. I expect it to become part of the unstable version today or tomorrow. But you can manually adjust the one line in your Dynare installation.

Thanks Johaness, it works fine now. Thanks a lot!

Actually, we have tried to enter the number of iterations in the following way:

NumberOfIterations = 15000 ;

estimation(mh_replic = NumberOfIterations,…

where NumberOfIterations changes depending on the country being run. However, the mh_replic does not seem to accept the variable NumberOfIterations, it just seems to accept a number. Please is there a way to make it work with a number that changes according to the country that is running?

Thank you very much


You would need to use the macroprocessor for that.

@#define NumberOfIterations = 15000
estimation(mh_replic = @{NumberOfIterations},…

Thank you very much!

Hello Johannes,

We have tried with the following line in the mod file:

@#define NumberOfIterations = Nite ;

where varialbe Nite is defined in a .m file as

Nite = NumberOfIterations.Iterations(k),

where NumberOfIterations is a number for each of the countries that comes from an excell file so that we can iterate over the countries.

However, it seems that in the .mod file Dynare reads the text “Nite” instead of a number, that is, variabler Nite.

Please is there a way the .mod file can read a number, variable Nite, instead of the text “Nite”?

Best regards,


This is the error message we are getting:

ERROR in macro-processor: TrendCycle_Stationary_Y_all_1979.mod:64.36-37: syntax error, unexpected TEXT, expecting EOL

Best regards,


You should probably just use a Matlab command then. Don’t set mh_replic in estimation , rather preface the estimation-command by


Dear Johaness,
That worked really well! Thank you very much.
Best regards,