diff --git a/tests/moments/fs2000_post_moments.mod b/tests/moments/fs2000_post_moments.mod index 995b87b73ee7ce307c00fbabe09f7f1f73fc5534..dd75b5f9f7afb441b596ab1b214007d4ce4d29ac 100644 --- a/tests/moments/fs2000_post_moments.mod +++ b/tests/moments/fs2000_post_moments.mod @@ -138,42 +138,42 @@ for par_iter=1:size(par.pdraws,1) end correlation=mean(correlation,3); -nvars=size(M_.endo_names(1:M_.orig_endo_nbr,:),1); +nvars=M_.orig_endo_nbr; for var_iter_1=1:nvars for var_iter_2=1:nvars - if max(abs(correlation(var_iter_1,var_iter_2:nvars:end)'-oo_.PosteriorTheoreticalMoments.dsge.correlation.Mean.(deblank(M_.endo_names{var_iter_1,:})).(deblank(M_.endo_names{var_iter_2,:}))))>1e-8 + if max(abs(correlation(var_iter_1,var_iter_2:nvars:end)'-oo_.PosteriorTheoreticalMoments.dsge.correlation.Mean.(M_.endo_names{var_iter_1}).(M_.endo_names{var_iter_2})))>1e-8 error('Correlations do not match') end end end covariance=mean(covariance,3); -nvars=size(M_.endo_names(1:M_.orig_endo_nbr,:),1); +nvars=M_.orig_endo_nbr; for var_iter_1=1:nvars for var_iter_2=var_iter_1:nvars - if max(abs(covariance(var_iter_1,var_iter_2)-oo_.PosteriorTheoreticalMoments.dsge.covariance.Mean.(deblank(M_.endo_names{var_iter_1,:})).(deblank(M_.endo_names{var_iter_2,:}))))>1e-8 + if max(abs(covariance(var_iter_1,var_iter_2)-oo_.PosteriorTheoreticalMoments.dsge.covariance.Mean.(M_.endo_names{var_iter_1}).(M_.endo_names{var_iter_2})))>1e-8 error('Covariances do not match') end end end variance_decomposition=mean(variance_decomposition,3); -nvars=size(M_.endo_names(1:M_.orig_endo_nbr,:),1); +nvars=M_.orig_endo_nbr; for var_iter_1=1:nvars for shock_iter=1:M_.exo_nbr - if max(abs(variance_decomposition(var_iter_1,shock_iter)/100-oo_.PosteriorTheoreticalMoments.dsge.VarianceDecomposition.Mean.(deblank(M_.endo_names{var_iter_1,:})).(deblank(M_.exo_names{shock_iter,:}))))>1e-8 + if max(abs(variance_decomposition(var_iter_1,shock_iter)/100-oo_.PosteriorTheoreticalMoments.dsge.VarianceDecomposition.Mean.(M_.endo_names{var_iter_1}).(M_.exo_names{shock_iter})))>1e-8 error('Variance decomposition does not match') end end end conditional_variance_decomposition=mean(conditional_variance_decomposition,4); -nvars=size(M_.endo_names(1:M_.orig_endo_nbr,:),1); +nvars=M_.orig_endo_nbr; horizon_size=size(conditional_variance_decomposition,3); for var_iter_1=1:nvars for shock_iter=1:M_.exo_nbr for horizon_iter=1:horizon_size - if max(abs(conditional_variance_decomposition(var_iter_1,horizon_iter,shock_iter)-oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition.Mean.(deblank(M_.endo_names{var_iter_1,:})).(deblank(M_.exo_names{shock_iter,:}))(horizon_iter)))>1e-8 + if max(abs(conditional_variance_decomposition(var_iter_1,horizon_iter,shock_iter)-oo_.PosteriorTheoreticalMoments.dsge.ConditionalVarianceDecomposition.Mean.(M_.endo_names{var_iter_1}).(M_.exo_names{shock_iter})(horizon_iter)))>1e-8 error('Conditional Variance decomposition does not match') end end