[Numpy-discussion] Polyfit

Anne Archibald peridot.faceted@gmail....
Mon Jun 16 20:33:11 CDT 2008


2008/6/16 Chandler Latour <deathicrow@gmail.com>:
> I believe I'm bound to python.
> In terms of forcing the regression through the origin, the purpose is partly
> for visualization but it also should fit the data.  It would not make sense
> to model the data with an initial value other than 0.

Polyfit is just a thin wrapper around numpy.linalg.lstsq. You can do
something like:
A = np.power.outer(xs,np.arange(1,n))
outputs = np.linalg.lstsq(A,ys)

Anne


More information about the Numpy-discussion mailing list