%SETUPDATA    Set up data file for maximum likelihood estimation
%             Store matrix `mled' in uszvarq.dat and `mledur' in
%             uszvarq_ur.dat

%             Ellen McGrattan, 3-15-04

load nipa115.csv
load nipa116.csv
load nipa119.csv
load nipa394.csv
load nipa395.csv
load prescott.csv

rGDP  = nipa116(2,:)';
rPCE  = nipa116(3,:)';
rCD   = nipa115(4,:)'./nipa119(4,:)'*100;
rCND  = nipa115(5,:)'./nipa119(5,:)'*100;
rCS   = nipa115(6,:)'./nipa119(6,:)'*100;
rGPDI = nipa116(4,:)';
rEX   = nipa116(5,:)';
rIM   = nipa116(6,:)';
rG    = nipa116(7,:)';
rGC   = nipa395(3,:)'./nipa394(3,:)'*100;
rGI   = nipa395(4,:)'./nipa394(4,:)'*100;

Y     = rGDP;
C     = rCND+rCS;
X     = rCD+rGPDI+rGI;
G     = rGC+rEX-rIM;
Pop   = prescott(:,4);
H     = prescott(:,8);

t     = ptime(1959.1,length(H),4);
hpc   = H./Pop;
prd   = Y./H*10^9;
ypc   = Y./Pop*10^9;
xpc   = X./Pop*10^9;
gpc   = G./Pop*10^9;

gz    = (1.016^(1/4))^81;
mled  = [t,ypc/ypc(81)*gz,xpc/ypc(81)*gz,hpc/1300,gpc/ypc(81)*gz];
nt    = length(t);
mledur= [t(2:nt),ypc(2:nt)./ypc(1:nt-1),xpc(2:nt)./xpc(1:nt-1), ...
         hpc(2:nt)/1300,gpc(2:nt)./gpc(1:nt-1)];
