Mismatch between second order moments of estimation and actual data

Thank you, professor

Actually, what I did first was using estimated parameters and simulating by (stoch_simul(order = 1,irf=20, nograph)) for matching second order moments(S.D and auotocorrelation) of the model and the actual data.

After your advise I have covered two other posts in dynare regarding matching second moments after Bayesian estimation which is very relevant to what I want.

post1
post2

I have been following that posts but always having error like:
EXECUTE_POSTERIOR_FUNCTION: Execution of prior/posterior function led to an error. Execution cancelled.
Brace indexing is not supported for variables of this type.

Error in disp_moments (line 41)
i_tmp = strmatch(var_list{i}, M_.endo_names, ‘exact’);

Error in posterior_function_demo (line 71)
oo_=disp_moments(ys,var_list,M_,options_,oo_);

Error in execute_prior_posterior_function (line 90)
junk=functionhandle(parameter_mat(1,:),M_,options_,oo_,estim_params_,bayestopt_,dataset_,dataset_info);

Error in test.driver (line 469)
oo_ = execute_prior_posterior_function(‘posterior_function_demo’, M_, options_, oo_, estim_params_, bayestopt_, dataset_, dataset_info, ‘posterior’);

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

Could please, advise ?

test.mod (11.9 KB)
posterior_function_demo.m (4.2 KB)

PS:
In the paper that I am trying to replicate says:


For each parameter draw obtained with the MCMC chains we simulate 500 samples of length equal to the data after
discarding the first 50 observations

I think it is using posterior_functin as well…

Thank you in advance