
%  Tendencias deterministas

clear
a = randn(100,2);
plot(a)
corr(a)
var(a)
t = .0:.1:9.9;
t = t';
size(t)
x = a(:,1)+t(:,1);
y = a(:,2)+.5*t(:,1);
corr(x,y)
plot(x)
plot(t)

[bhat,residuos,sigma2,vcov,estadt,pvalort,R2]=mco_breve(y,[ones(100,1) x]);
[bhat estadt]
[bhat,residuos,sigma2,vcov,estadt,pvalort,R2]=mco_breve(a(:,2),[ones(100,1) a(:,1)]);
[bhat estadt]
[bhat,residuos,sigma2,vcov,estadt,pvalort,R2]=mco_breve(y,[ones(100,1) t x]);
[bhat estadt]

[bhat,res1,sigma2,vcov,estadt,pvalort,R2]=mco_breve(x,[ones(100,1) t]);
[bhat estadt]
[bhat,res2,sigma2,vcov,estadt,pvalort,R2]=mco_breve(y,[ones(100,1) t]);
[bhat estadt]
[bhat,residuos,sigma2,vcov,estadt,pvalort,R2]=mco_breve(res2,[ones(100,1) res1]);
[bhat estadt]


%    Tendencias estocasticas: Raices unitarias

m(1,1)=10;
n(1,1)=10;
for i=1:100
m(i+1,1) = m(i,1)+a(i,1);
n(i+1,1) = n(i,1)+a(i,2);
end
corr(m,n)

[bhat,residuos,sigma2,vcov,estadt,pvalort,R2]=mco_breve(n,[ones(101,1) m]);
[bhat estadt]
plot([m n])

