close all;
clear all;

%this sets up the Minnesota dummy priors and computes various related objects

lam1=5;
lam2=1;
lam3=2;
lam4=5;
y1b=4;
y2b=3;

phi1=1;
phi2=1;
s1=.01;
s2=.03;

Y1=[phi1*s1*lam1 0;0 phi2*s2*lam1];
X1=[0 lam1*s1 0 0 0;0 0 lam1*s2 0 0];
Y2=zeros(2,2);
X2=zeros(2,5);
X2(1,4)=lam1*s1;
X2(2,5)=lam1*s2;
Y3=[lam3*y1b 0;0 lam3*y2b];
X3=[0 lam3*y1b 0 lam3*y1b 0;0 0 lam3*y2b 0 lam3*y2b];
Y4=[lam4*y1b lam4*y2b];
X4=[lam4 lam4*y1b lam4*y2b lam4*y1b lam4*y2b];

Y=[Y1;Y2;Y3;Y4];
X=[X1;X2;X3;X4];

%matrix of OLS parameter estimates for dummy's
a=inv(X'*X)\(X'*Y);

% Y-X*beta = Y-X*inv(X'*X)*(X'*Y)=[I-X*inv(X'*X)*X']*Y=M*Y
% M is the famous idempotent matrix in OLS, M*M=M
M=eye(7)-X*inv(X'*X)*X';

%matrix of fitted residuals for dummy's
E=M*Y;

%matrix of sum of square error residuals for dummy's
S=E'*E;

1+1;





