From 6ff924550cb857fb700e2acabce803fd4af00f59 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Sun, 7 Jan 2024 10:24:13 +0100 Subject: [PATCH] compute_variance_decomposition.m: only print warning if absolute difference is meaningful Prevents warnings if relative difference involves division by almost 0 --- matlab/moments/compute_variance_decomposition.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/moments/compute_variance_decomposition.m b/matlab/moments/compute_variance_decomposition.m index 97b7afde20..c05ddd86b5 100644 --- a/matlab/moments/compute_variance_decomposition.m +++ b/matlab/moments/compute_variance_decomposition.m @@ -56,7 +56,7 @@ else var_decomp(stationary_vars,i) = vx2; variance_sum_loop = variance_sum_loop +vx2; %track overall variance over shocks end - if ~options_.pruning && max(abs(variance_sum_loop-var_stationary)./var_stationary) > 1e-4 + if ~options_.pruning && max(abs(variance_sum_loop-var_stationary)./var_stationary) > 1e-4 && max(abs(variance_sum_loop-var_stationary))>1e-7 warning(['Aggregate variance and sum of variances by shocks ' ... 'differ by more than 0.01 %']) end -- GitLab