function r = tchregline(x,y)
%
% tchregline - compute regression line coefficients
% On input:
%     x: independent variable
%     y: dependent variable
% On output:
%     r: (a,b) regression coefficients (least squares best fit)
%         where Y' = a + bx
% Call:
%     r = tchregline(x,y);
%

n = length(x);
b = (sum(x.*y) - ((sum(x)*sum(y))/n))/((sum(x.^2) - ((sum(x)^2)/n)));
a = tchmean(y) - b*tchmean(x);
r = [a,b];
