Skip to content
Snippets Groups Projects
Verified Commit a48a03bc authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

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.
parent 942d8846
Branches
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment