%   STEADSTS.M
%
%  Computes steady states and seasonal means for a periodic recursive
%  linear equilibrium model.
%  SOLVES.M and SIMULS.M must be run first, and their outputs must be in
%  memory.  First, the program computes the mean of the state vector
%  for the periodic model, by forming the null space of (I - Ah), where
%  Ah is the state transition matrix for the stacked state vector
%  (see SIMULS.M).  Then the program computes the seasonal means by
%  computing the relevant linear combination of the steady state vector,
%  using the periodic decision rules.
%  You must edit the indicated line in this program to get the seasonal
%  means for the variable you are interested in.  (The program is set up
%  to compute seasonal means for consumption.)
%
%  The parameter nnc, which is the index of the constant term in the state
%  vector, must be in memory.

nsize=max(size(Ah));
e1=eye(nsize);
zz=null(e1-Ah);
zs=zz./zz(nnc);
										
% Now compute seasonal means of observables
H=zeros(p,n*p)';
for j=1:p
nj=int2str(j);
eval(['H((j-1)*n+1:j*n,j)=sc',nj,''';'])    %  edit this line to get means
					    %  of other processes.
end
meanc=H'*zs
for j=1:p
nj=int2str(j);
eval(['H((j-1)*n+1:j*n,j)=si',nj,''';'])    %  edit this line to get means
					    %  of other processes.
end
meani=H'*zs
for j=1:p
nj=int2str(j);
eval(['H((j-1)*n+1:j*n,j)=sk',nj,''';'])    %  edit this line to get means
					    %  of other processes.
end
meank=H'*zs
