[SciPy-User] How to fit data with errorbars

Nathaniel Smith njs@pobox....
Tue Feb 16 22:18:17 CST 2010

On Tue, Feb 16, 2010 at 7:48 PM,  <josef.pktd@gmail.com> wrote:
> I didn't realize that it is a problem linear in parameters if the
> objective is to fit a polynomial.

I dunno, I'm just going off a quick glance at the documentation for
"polyfit", which the OP wanted to use in the first place :-).

> Essentially the same calculations are done in statsmodels.WLS  plus
> you get additional results and test statistics.
> something like
> wls_results = scikits.statsmodels.WLS(Y, np.vander(X,2), weights=1/stddevs)
> wls_results.params
> wls_results.bse
> wls_results.fittedvalues
> example in statsmodels\examples\tut_ols_wls.py

Yeah, using real statistics code is always a better idea when
available. (Actually, I would use R for this. Don't tell anyone!)

-- Nathaniel

More information about the SciPy-User mailing list