Re: forcing to pass origin in linear regression



"Young Ryu" <ryuyr77@xxxxxxxxx> wrote in message <g58va4$fep
$1@xxxxxxxxxxxxxxxxxx>...
Hi

I have two arrays:

A=[1, 2, 3, 4, 5]
B=[2, 4, 6, 7, 11]

I'd like to make a linear regression between A and B, but
want to force the regression line to pass the origin. Can
you help me how to do this?

Thanks!

Note that there is a different solution to this problem that minimizes the
mean square orthogonal distance of A, B pairs from the line b = m*a.

[U,S,V] = svd([A(:) B(:)],0);
m = -V(1,2)/V(2,2);

If values in A and B are both subject to the same kind of error, it is a best-
fitting line in the least squares sense. However, this is not ordinarily referred
to as linear regression. This line will lie in the angle between the two
regression lines in which 1) A is the independent variable and 2) B is the
independent variable. These three lines are only equal in case the values in A
and B are exactly proportional.

Roger Stafford

.