function ratio=VARratior(spot,futures)


length=size(spot,1);
beta1=regress(spot(2:length),[ones(length-1,1) spot(1:length-1) futures(1:length-1)]);
beta2=regress(futures(2:length),[ones(length-1,1) spot(1:length-1) futures(1:length-1)]);
resid1=spot(2:length)-[ones(length-1,1) spot(1:length-1) futures(1:length-1)]*beta1;
resid2=futures(2:length)-[ones(length-1,1) spot(1:length-1) futures(1:length-1)]*beta2;
ratio=cov(resid1,resid2)/var(resid2);
ratio=ratio(1,2);