Commit c2f7f0a5 authored by Michel Juillard's avatar Michel Juillard
Browse files

computes now variance decomposition relative to the sum of the effects of...

computes now variance decomposition relative to the sum of the effects of individual shocks rather than aggregate variance.
When the aggregate variance differs from the shock of the sum of the effects of individual shocks by more than 0.01% a warning is displayed.

This behaviour is documented in the reference manual.
parent f85049e9
......@@ -2090,6 +2090,9 @@ steady(homotopy_mode = 1, homotopy_steps = 50);
<para>
Variance decomposition, correlation, autocorrelation are only displayed for variables with positive variance. Impulse response functions are only plotted for variables with response larger than 10<superscript>-10</superscript>.
</para>
<para>
Variance decomposition is computed relative to the sum of the contribution of each shock. Normally, this is of course equal to aggregate variance, but if a model generates very large variances, it may happen that, due to numerical error, the two differ by a significant amount. Dynare issues a warning if the maximum relative difference between the sum of the contribution of each shock and aggregate variance is larger than 0.01 %.
</para>
<para>
Currently, the IRFs are only plotted for 12 variables. Select the ones you want to see, if your model contains more than 12 endogenous variables.
</para>
......
......@@ -147,9 +147,20 @@ if options_.hp_filter == 0
b2 = b2*cs;
vx = lyapunov_symm(A,b1*b1',options_.qz_criterium,options_.lyapunov_complex_threshold,1);
vv = diag(aa*vx*aa'+b2*b2');
vv2 = 0;
for i=1:M_.exo_nbr
vx1 = lyapunov_symm(A,b1(:,i)*b1(:,i)',options_.qz_criterium,options_.lyapunov_complex_threshold,2);
Gamma_y{nar+2}(stationary_vars,i) = abs(diag(aa*vx1*aa'+b2(:,i)*b2(:,i)'))./vv;
vx2 = abs(diag(aa*vx1*aa'+b2(:,i)*b2(:,i)'));
Gamma_y{nar+2}(stationary_vars,i) = vx2;
vv2 = vv2 +vx2;
end
if max(abs(vv2-vv)./vv) > 1e-4
warning(['Aggregate variance and sum of variances by shocks ' ...
'differ by more than 0.01 %'])
end
for i=1:M_.exo_nbr
Gamma_y{nar+2}(stationary_vars,i) = Gamma_y{nar+ ...
2}(stationary_vars,i)./vv2;
end
end
else% ==> Theoretical HP filter.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment