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.
. 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.
Question1 :Can you suggest what are my problems and how I can fix this?
I guess the problem come from the code: get_quarterly_moment
Question 2: From the file: get_quarterly_moment, I want to get the moment from growth(e.g output growth), instead of output level how can I modify this code:
from the original code
Y_quarterly_sum_aggregation(:,ii)=squeeze(sum(simulated_series(strmatch(‘Y’,M_.endo_names,‘exact’),(ii-1)3+1:ii3,:)));
Y_level_quarterly_sum_aggregation(:,ii)=squeeze(sum(exp(simulated_series(strmatch(‘Y’,M_.endo_names,‘exact’),(ii-1)3+1:ii3,:))));
C_quarterly_sum_aggregation(:,ii)=squeeze(sum(simulated_series(strmatch(‘C’,M_.endo_names,‘exact’),(ii-1)3+1:ii3,:)));
I_quarterly_sum_aggregation(:,ii)=squeeze(sum(simulated_series(strmatch(‘I’,M_.endo_names,‘exact’),(ii-1)3+1:ii3,:)));
I add these lines to comput the growth
:
gY_cyc_FGRU(:,ii)=(Y_quarterly_sum_aggregation(:,ii)-Y_quarterly_sum_aggregation(:,ii-1))/Y_quarterly_sum_aggregation(:,ii-1);
gC_cyc_FGRU(:,ii)=(C_quarterly_sum_aggregation(:,ii)-C_quarterly_sum_aggregation(:,ii-1))/C_quarterly_sum_aggregation(:,ii-1);
gN_cyc_FGRU(:,ii)=(N_quarterly_sum_aggregation(:,ii)-N_quarterly_sum_aggregation(:,ii-1))/N_quarterly_sum_aggregation(:,ii-1);
but the error came out as
Subscript indices must either be real positive integers or logicals.
Error in get_quarterly_moments (line 85)
gY_cyc_FGRU(:,ii)=(Y_quarterly_sum_aggregation(:,ii)-Y_quarterly_sum_aggregation(:,ii-1))/Y_quarterly_sum_aggregation(:,ii-1);
Error in Model_Uncertainty7 (line 424)
[moments_short]=get_quarterly_moments(out_withshock(:,:,1:200),ergodicmean_no_shocks,M_,oo_);
Error in dynare (line 223)
evalin(‘base’,fname) ;generate_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.8 KB)
Please help me explain the procedure to run your code set. I do not know how to obtain SMM estimated parameters.
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 much