From c33b53b045d7f5e42ec9af73f87947e8bb467103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Argos=29?= Date: Fri, 19 Jan 2024 17:40:50 +0100 Subject: [PATCH] Bug fix (wrong condition) 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 8f9885dab..6830855d5 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) 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) 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) 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