On Wed, Apr 22, 2009 at 11:48 AM, Mathew Yeates <[email protected]>wrote:

> well, this isn't a perfect solution. polyfit  is better because it
> determines rank based on condition values. Finds the eigenvalues ...
> etc. But, unless it can vectorized without Python looping, it's too slow
> for me to use
>




rank is a property of the design matrix.

In your case the design matrix is a vector of ones and the x vector. So the
only case, where you run into problems, is when your three observation of x
are the same, then dot(x.T*x) is zero, you can only have one constant. If
there is no slope in x then you don't have three different observations to
estimate a slope coefficient.

Just special case (x*x).sum(1)<1e-8   or something, in this case
yestimate = y.mean

eigen vectors with one regressor are pretty useless or trivial, same with
rank.

For higher order polynomials this will become more important, but not for a
linear polynomial.

Josef
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to