%fgss1.m   Sept. 23, 1996
%Calcultaes solution to basic ss model with parameters as 
% in Farmer's book
% Checks for stability under learning. t-1 dating
m=0.23;nu=1.21;discount=0.99;delta=0.025;phi=1;mu=0.4;
ytok=(phi/discount+delta-1)/m;
ctok=ytok-delta+1-phi;
bet11=1+m*nu*ytok*discount/((1-nu)*phi);
bet12=(discount/phi)*m*ytok*(1-mu/(1-nu));
del21=-(ctok+ytok*nu/(1-nu))/phi;
del22=(1-delta+ytok*mu/(1-nu))/phi;
b=eye(2);
b(2,1)=del21;
b(2,2)=del22;
b(1,1)=(1-bet12*del21)/bet11;
b(1,2)=-bet12*del22/bet11;
bss=b;
eig(bss);
% check
j=inv(b);
eig(j);

mdel=zeros(2);
mdel(2,1)=del21;mdel(2,2)=del22;
mbet=zeros(2);mbet(1,1)=bet11;mbet(1,2)=bet12;

% Learning of ss solution in Farmer-Guo model is stable if all the following roots have real
% parts less than 1 (necessary condition)
dtb=kron(b',mbet)+kron(eye(2),mbet*bss);
eig(dtb)
dta=mbet+mbet*bss;
eig(dta)