# Problem with Input dimension in mexErrCheck

Dear all

I am going to replicate the code from paper :“Risk matter: A comment”

Because I am quite fresh to this dynare, thus I have redesigned the code, but the problem come out as:

Input dimension error!
Error using mexErrCheck (line 41)
Error encountered in: A_times_B_kronecker_C.

Error in simult_FGRU (line 165)
mexErrCheck(‘A_times_B_kronecker_C’, err);

Error in Model_uncertainty6 (line 475)
[y_, y1st]=
simult_FGRU(ergodicmean_no_shocks,oo_.dr,shock_mat(1:end-1,:,ii),options_.order,zeros(size(oo_.dr.ys)),zeros(M_.exo_nbr,1));

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

I try to fix this but It does not work. please let me know any way to over come this

Thank you so muchempirical_moment.m (1.2 KB)
generate_FGRU_shocks.m (2.2 KB)
get_quarterly_moments.m (5.8 KB)
hpfilter.m (466 Bytes)
Model_Uncertainty6.mod (12.9 KB)
simult_FGRU.m (9.2 KB)

What exactly did you change and what are you trying to achieve?

Dear Prof. Pfeifer

I am conducting the exercise for matching moment by using your code in “Risk matter: A comment” for my model. That is a non-linear DSGE with stochastic volatility shock.

The moments I want to match are: variance of output, variance of consumption relative to output, variance of labor relative to output, correlation of output and consumption, and correlation of output and labor.

I solve the problem with input dimension. This code run but there are something I need to learn from Professor.

1. I computed the moment from my model but the results are weird for variance out output (too big), variance output to consumption and correlation output and consumption is 1.

Can you suggest what are my problems and how I can fix this?

1. I guess the problem come from the code: get_quarterly_moment

Can you explain: Y_quarterly_sum_aggregation(:,ii)=squeeze(sum(simulated_series(strmatch(‘y’,M_.endo_names,‘exact’),(ii-1)3+1:ii3,:)));

I counldnt find the code: simulated_series

1. I have a question related to SMM simulation in code: smm_diff_function.m"

I see that code: “Born_Pfeifer_RM_Comment.mod” in recalibration part, Professor obtain SMM estimated paramters before running this code.

P/S: I attached my code, please take a look when Professor have time and give me some suggestion on my current issue. Thank you so muchgenerate_FGRU_shocks.m (2.2 KB)
get_quarterly_moments.m (5.9 KB)
Model_Uncertainty6.mod (15.8 KB)
simult_FGRU.m (9.2 KB)
smm_diff_function.m (4.7 KB)

Dear Prof. Pfeifer

I am conducting the exercise for matching moment by using your code in “Risk matter: A comment” for my model. That is a non-linear DSGE with stochastic volatility shock.

The moments I want to match are: variance of output, variance of consumption relative to output, variance of labor relative to output, correlation of output and consumption, and correlation of output and labor.

I solve the problem with input dimension. This code run but there are something I need to learn from Professor.

I computed the moment from my model but the results are weird for variance out output (too big), variance output to consumption and correlation output and consumption is 1.

Can you suggest what are my problems and how I can fix this?

I guess the problem come from the code: get_quarterly_moment

Can you explain: Y_quarterly_sum_aggregation(:,ii)=squeeze(sum(simulated_series(strmatch(‘y’,M_.endo_names,‘exact’),(ii-1)3+1:ii3,:)));

I counldnt find the code: simulated_series

I have a question related to SMM simulation in code: smm_diff_function.m"

I see that code: “Born_Pfeifer_RM_Comment.mod” in recalibration part, Professor obtain SMM estimated paramters before running this code.