Home > matlab > kalman > steady_state_kalman_gain.m

steady_state_kalman_gain

PURPOSE ^

Given the invariant state space representation of a model, this

SYNOPSIS ^

function [K,iF,P] = steady_state_kalman_gain(T,R,Q,H,mf)

DESCRIPTION ^

 Given the invariant state space representation of a model, this
 function computes the gain matrix and the covariance matrix of the
 state vector at the steady state of the kalman filter. 
 
 INPUTS 
   T   [double]    m*m transition matrix of the state vector.  
   R   [double]    m*q matrix (q is the number of structural innovations).
   Q   [double]    q*q covariance matrix of the structural innovations.
   H   [double]    p*p covariance matrix of the measurement error.
   mf  [integer]   p*1 vector, indices for the observed variables
    
 OUTPUTS 
   K   [double]    kalman gain matrix.
   P   [double]    covariance matrix of the state vector.
               
 SPECIAL REQUIREMENTS
   Needs a solver for Riccati equations (dare.m)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [K,iF,P] = steady_state_kalman_gain(T,R,Q,H,mf)
0002 % Given the invariant state space representation of a model, this
0003 % function computes the gain matrix and the covariance matrix of the
0004 % state vector at the steady state of the kalman filter.
0005 %
0006 % INPUTS
0007 %   T   [double]    m*m transition matrix of the state vector.
0008 %   R   [double]    m*q matrix (q is the number of structural innovations).
0009 %   Q   [double]    q*q covariance matrix of the structural innovations.
0010 %   H   [double]    p*p covariance matrix of the measurement error.
0011 %   mf  [integer]   p*1 vector, indices for the observed variables
0012 %
0013 % OUTPUTS
0014 %   K   [double]    kalman gain matrix.
0015 %   P   [double]    covariance matrix of the state vector.
0016 %
0017 % SPECIAL REQUIREMENTS
0018 %   Needs a solver for Riccati equations (dare.m)
0019 
0020 % Copyright (C) 2004-2009 Dynare Team
0021 %
0022 % This file is part of Dynare.
0023 %
0024 % Dynare is free software: you can redistribute it and/or modify
0025 % it under the terms of the GNU General Public License as published by
0026 % the Free Software Foundation, either version 3 of the License, or
0027 % (at your option) any later version.
0028 %
0029 % Dynare is distributed in the hope that it will be useful,
0030 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0031 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0032 % GNU General Public License for more details.
0033 %
0034 % You should have received a copy of the GNU General Public License
0035 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0036 
0037 m = length(T);
0038 p = length(mf);
0039 Z = build_selection_matrix(mf,m,p);
0040 
0041 if isempty(H)
0042     H = zeros(p,p);
0043 end
0044 
0045 QQ = R*Q*transpose(R);
0046 
0047 P  = dare(T,transpose(Z),QQ,H);
0048 
0049 iF = inv(Z*P*transpose(Z)+H);
0050 K  = T*P*transpose(Z)*iF;

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005