From a48a03bc67114829d7864372ac67c3804d7e2d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Argos=29?= <stepan@adjemian.eu> Date: Fri, 19 Jan 2024 17:40:50 +0100 Subject: [PATCH] Bug fix (wrong condition). Also add comments about the choice for the definition of the linear combination of the VAR companion variables. We should test the numbe of output arguments, not the number of input arguments. This was bug was probably not affecting the outcomes since the number of input arguments is always greater than 1. --- matlab/pac-tools/hVectors.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/matlab/pac-tools/hVectors.m b/matlab/pac-tools/hVectors.m index 8f9885dab5..7b1186f6d2 100644 --- a/matlab/pac-tools/hVectors.m +++ b/matlab/pac-tools/hVectors.m @@ -18,7 +18,7 @@ function [h, lrcp] = hVectors(params, H, auxmodel, kind, id) % params(2:end-1) ⟶ Autoregressive parameters. % params(end) ⟶ Discount factor. -% Copyright © 2018-2021 Dynare Team +% Copyright © 2018-2024 Dynare Team % % This file is part of Dynare. % @@ -52,21 +52,21 @@ n = length(H); tmp = eye(n*m)-kron(G, transpose(H)); % inv(W2) switch kind - case 'll' + case 'll' % (A.84), page 28 in Brayton, Davis and Tulip (2000) ⟹ The target is stationary (level-level). h = A_1*A_b*((kron(iota(m, m), H))'*(tmp\kron(iota(m, m), iota(n, id)))); - case 'dd' + case 'dd' % (A.79), page 26 in Brayton, Davis and Tulip (2000) ⟹ The target appears in first difference as a dependent variable in the auxiliary model. h = A_1*A_b*(kron(iota(m, m)'*inv(eye(m)-G), H')*(tmp\kron(iota(m, m), iota(n, id)))); - case 'dl' + case 'dl' % (A.74), page 24 in Brayton, Davis and Tulip (2000) ⟹ The target appears in level as a dependent variable in the auxiliary model. h = A_1*A_b*(kron(iota(m, m)'*inv(eye(m)-G), (H'-eye(length(H))))*(tmp\kron(iota(m, m), iota(n, id)))); otherwise error('Unknown kind value in PAC model.') end -if nargin>1 +if nargout>1 if isequal(kind, 'll') lrcp = NaN; else d = A_1*A_b*(iota(m, m)'*inv((eye(m)-G)*(eye(m)-G))*iota(m, m)); lrcp = (1-sum(params(2:end-1))-d); end -end \ No newline at end of file +end -- GitLab