diff --git a/matlab/getH.m b/matlab/getH.m
index 56e226803e30e7fb220b707b4159c3249fb1444d..41913ff613dfb640890befa81fe9dd8d02d369c6 100644
--- a/matlab/getH.m
+++ b/matlab/getH.m
@@ -1,4 +1,4 @@
-function [H, A0, B0, dA, dOm, info] = getH(M_,oo_,kronflag,indx,indexo)
+function [H, dA, dOm, info] = getH(A, B, M_,oo_,kronflag,indx,indexo)
% computes derivative of reduced form linear model w.r.t. deep params
%
@@ -62,15 +62,15 @@ param_nbr = length(indx);
% order_var = [oo_.dr.order_var; ...
% [size(oo_dr.ghx,2)+1:size(oo_dr.ghx,2)+size(oo_.dr.transition_auxiliary_variables,1)]' ];
% [A(order_var,order_var),B(order_var,:)]=dynare_resolve;
-[A,B,ys,info]=dynare_resolve;
- if info(1) > 0
- H = [];
- A0 = [];
- B0 = [];
- dA = [];
- dOm = [];
- return
- end
+% [A,B,ys,info]=dynare_resolve;
+% if info(1) > 0
+% H = [];
+% A0 = [];
+% B0 = [];
+% dA = [];
+% dOm = [];
+% return
+% end
m = size(A,1);
n = size(B,2);
@@ -277,7 +277,7 @@ else % generalized sylvester equation
y = B*dSig*B';
y = y(nauxe+1:end,nauxe+1:end);
H(:,j) = [zeros((m-nauxe)^2,1); vech(y)];
- if nargout>3,
+ if nargout>1,
dOm(:,:,j) = y;
end
dSig(indexo(j),indexo(j)) = 0;
@@ -289,7 +289,7 @@ else % generalized sylvester equation
y = y*M_.Sigma_e*B'+B*M_.Sigma_e*y';
x = x(nauxe+1:end,nauxe+1:end);
y = y(nauxe+1:end,nauxe+1:end);
- if nargout>3,
+ if nargout>1,
dA(:,:,j+length(indexo)) = x;
dOm(:,:,j+length(indexo)) = y;
end
diff --git a/matlab/getJJ.m b/matlab/getJJ.m
index 7a42a25c5848a20295a418d71bcf7b825cf58185..8d5ce2fac0b919c3fbc0d6fd4e6c7e9e4b65ad57 100644
--- a/matlab/getJJ.m
+++ b/matlab/getJJ.m
@@ -1,4 +1,4 @@
-function [JJ, H, A, B, GAM] = getJJ(M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
+function [JJ, H, gam] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
% Copyright (C) 2009 Dynare Team
%
@@ -17,10 +17,10 @@ function [JJ, H, A, B, GAM] = getJJ(M_,oo_,options_,kronflag,indx,indexo,mf,nlag
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
-if nargin<5 | isempty(indx), indx = [1:M_.param_nbr];, end,
-if nargin<6 | isempty(indexo), indexo = [];, end,
-if nargin<8 | isempty(nlags), nlags=3; end,
-if nargin<9 | isempty(useautocorr), useautocorr=0; end,
+if nargin<7 | isempty(indx), indx = [1:M_.param_nbr];, end,
+if nargin<8 | isempty(indexo), indexo = [];, end,
+if nargin<10 | isempty(nlags), nlags=3; end,
+if nargin<11 | isempty(useautocorr), useautocorr=0; end,
if useautocorr,
warning('off','MATLAB:divideByZero')
@@ -33,12 +33,12 @@ if kronflag == -1,
assignin('base','M_', M_);
assignin('base','oo_', oo_);
else
- [H, A, B, dA, dOm, info] = getH(M_,oo_,kronflag,indx,indexo);
- if info(1) > 0
- JJ = [];
- GAM = [];
- return
- end
+ [H, dA, dOm] = getH(A, B, M_,oo_,kronflag,indx,indexo);
+% if isempty(H),
+% JJ = [];
+% GAM = [];
+% return
+% end
m = length(A);
GAM = lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold,1);
@@ -107,8 +107,16 @@ else
JJ(:,j+nexo) = dumm;
end
- if nargout >4,
+ if nargout >2,
+ sy=sy(mf,mf);
+ sy=sy-diag(diag(sy))+eye(length(mf));
+ options_.ar=nlags;
[GAM,stationary_vars] = th_autocovariances(oo_.dr,oo_.dr.order_var(mf),M_,options_);
+ GAM{1}=GAM{1}./sy;
+ gam = vech(GAM{1});
+ for j=1:nlags,
+ gam = [gam; vec(GAM{j+1})];
+ end
end
end