clear all
close all
clc

x = load('us2.txt');
t = x(:,1);
lgdp = log(x(:,2));
lcpi = log(x(:,3));
lm1 = log(x(:,4));

dlm1 = lm1 - lag(lm1,1);
dlgdp = lgdp - lag(lgdp,1);
dlcpi = lcpi - lag(lcpi,1);

X = [lag(lm1,1) lag(lcpi,1) lag(lgdp,1)];

krit_store = zeros([6,2]);

for i = 1:3
  X = [X  lag(dlm1,i) lag(dlcpi,i) lag(dlgdp,i)];
  [b krit] = ols2(dlm1,X);
  krit_store(i,:) = krit;
end

krit_store

gamma = b(1,1);
alpha = -b(2,1)/gamma;
beta = -b(3,1)/gamma;









