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.
Stéphane Adjemian (Argos) 2024-01-19 17:40:50 +01:00
parent 50beb8000d
commit c33b53b045
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
1 changed files with 6 additions and 6 deletions

View File

@ -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
end