No BSD License  

Highlights from
Solution to Linear Rational Expectations Models

from Solution to Linear Rational Expectations Models by Pawel Kowal
Solves linear rational expectation models, delivers derivatives of solutions

state_find(K,R)
function I = state_find(K,R)

%  PURPOSE: finds whether some additional variable can be chosen as state variables
%
% ---------------------------------------------------
%  USAGE: state_check(K,R)
%  where: 
%         K                         a matrix representing state variables
%         R                         a matrix determining observations in
%                                   the system
%                                       u_t   = P u_t-1 + V epsilon_t
%                                       y_t   = R u_t   + W epsilon_t
%
%  Output:
%        I                          indices of variables. One of these variables may
%                                   be chosen as an additional state variable.
%
%   COMMENTS:
%
% Copyright  (c) Pawel Kowal (2006)
% All rights reserved
% LREM_SOLVE toolbox is available free for noncommercial academic use only.
% pkowal3@sgh.waw.pl

[Q,M,E]       = qr((K*R)');
tol           = 10*max(size(M)')*norm(M,1)*eps;
n             = rank2(M,tol);
    
if n==size(R,2)
    I       = [];
    return;
end

R           = R*Q;
R           = sum(abs(R(:,n+1:end)),2);
I           = find(R>1000*eps);

Contact us at files@mathworks.com