


function [A,B] = transition_matrix(dr, varargin)
Makes transition matrices out of ghx and ghu
INPUTS
dr: structure of decision rules for stochastic simulations
varargin: {1}: M_
OUTPUTS
A: matrix of effects of predetermined variables in linear solution (ghx)
B: matrix of effects of shocks in linear solution (ghu)
SPECIAL REQUIREMENTS
none

0001 function [A,B] = transition_matrix(dr, varargin) 0002 % function [A,B] = transition_matrix(dr, varargin) 0003 % Makes transition matrices out of ghx and ghu 0004 % 0005 % INPUTS 0006 % dr: structure of decision rules for stochastic simulations 0007 % varargin: {1}: M_ 0008 % 0009 % OUTPUTS 0010 % A: matrix of effects of predetermined variables in linear solution (ghx) 0011 % B: matrix of effects of shocks in linear solution (ghu) 0012 % 0013 % SPECIAL REQUIREMENTS 0014 % none 0015 0016 % Copyright (C) 2003-2009 Dynare Team 0017 % 0018 % This file is part of Dynare. 0019 % 0020 % Dynare is free software: you can redistribute it and/or modify 0021 % it under the terms of the GNU General Public License as published by 0022 % the Free Software Foundation, either version 3 of the License, or 0023 % (at your option) any later version. 0024 % 0025 % Dynare is distributed in the hope that it will be useful, 0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0028 % GNU General Public License for more details. 0029 % 0030 % You should have received a copy of the GNU General Public License 0031 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0032 0033 if(length(varargin)<=0) 0034 global M_ 0035 else 0036 M_=varargin{1}; 0037 end; 0038 0039 exo_nbr = M_.exo_nbr; 0040 ykmin_ = M_.maximum_endo_lag; 0041 0042 nx = size(dr.ghx,2); 0043 kstate = dr.kstate; 0044 ikx = [dr.nstatic+1:dr.nstatic+dr.npred]; 0045 0046 A = zeros(nx,nx); 0047 k0 = kstate(find(kstate(:,2) <= ykmin_+1),:); 0048 i0 = find(k0(:,2) == ykmin_+1); 0049 A(i0,:) = dr.ghx(ikx,:); 0050 B = zeros(nx,exo_nbr); 0051 if(isfield(dr,'ghu')) 0052 B(i0,:) = dr.ghu(ikx,:); 0053 end; 0054 for i=ykmin_:-1:2 0055 i1 = find(k0(:,2) == i); 0056 n1 = size(i1,1); 0057 j = zeros(n1,1); 0058 for j1 = 1:n1 0059 j(j1) = find(k0(i0,1)==k0(i1(j1),1)); 0060 end 0061 A(i1,i0(j))=eye(n1); 0062 i0 = i1; 0063 end