function [best, kriteria] = ols2(y,X)

u = find (all (~isnan([y,X]),2));
T= length(u);
k = size(X,2);

best = inv(X(u,:)'*X(u,:))*X(u,:)'*y(u,:);
eest = y - X*best;

se2 = eest(u,:)'*eest(u,:)/ (T-k);
sb2 = se2 * inv(X(u,:)'*X(u,:));
tratio = best ./sqrt(diag(sb2));
crit = tinv(0.975,T-k);
best =  [best ,tratio, crit * ones(size(best))];

aic = log(se2) + 2*k/T;
sbc = log(se2) + log(T) * k/T;

kriteria = [aic sbc];

return













