Problem with shock decomposition

Hi ,
Shock decomposition doesn’t run
this message appears each time I run it:

Subscripted assignment dimension mismatch.

Error in read_variables (line 101)
dyn_data_01(:,dyn_i_01) = dyn_tmp_01;

Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,],xls.sheet,xls.range);

Error in dynare_estimation_init (line 475)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);

Error in evaluate_smoother (line 54)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list, M_.fname, ], M_, options_,
oo_, estim_params_, bayestopt_);

Error in shock_decomposition (line 64)
oo = evaluate_smoother(parameter_set,varlist);

Error in SA (line 426)
oo_ = shock_decomposition(M_,oo_,options_,var_list_);

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

What’s wrong with that?

Thank you

Best regards

As always, state the version you are using an provide files to replicate the issue.

what do you mean by to state the version?
it’s the first time I run a shock decomposition

thank you
best
SA.mod (10.8 KB)

You should state which Dynare version you are using. Also, the data file is missing.

I use dynare 4.4.3
I attached below the data
nico.xls (69.5 KB)

In your Excel file you must not have two columns in the same sheet with the same heading. In the first sheet that Dynare tries to read, all variables are there twice. Moreover, there is a bug that will show up subsequently. You are trying to run the shock decomposition on an estimated model using the parameter_set=calibration option. To make this work, you need to enclose the line

M_ = set_all_parameters(xparam1,estim_params_,M_);
in DsgeSmoother.m with

if ~isempty(xparam1) 
    M_ = set_all_parameters(xparam1,estim_params_,M_);
end

Thank you Dear Pfeifer
The problem is fixed now

Best

Dear all,

I’m sorry that I have to post in this topic again. I get exactly the same error messages when I try to run my shock decomposition:

Error in ==> evaluate_smoother at 54
[dataset_,dataset_info,xparam1, hh, M_, options_, oo_,
estim_params_,bayestopt_] = dynare_estimation_init(var_list, M_.fname, ], M_,
options_, oo_, estim_params_, bayestopt_);

Error in ==> shock_decomposition at 64
oo = evaluate_smoother(parameter_set,varlist);

Error in ==> cmr at 3082
oo_ = shock_decomposition(M_,oo_,options_,var_list_);

Error in ==> dynare at 180
evalin(‘base’,fname) ;

Even though I tried to modify my code with the lines you’ve mentioned, it didn’t work. Can anybody tell me - or maybe explain a bit in more detail - how to fix this bug? I use Dynare 4.4.3 and I try to replicate the Code of Christiano, Moto and Rostagno’s “Risk Shocks”.

Best regards

Could you please try the current unstable version. If it does not work, please provide the full files.