[SciPy-User] least square fit with weight in linalg.lstsq

josef.pktd@gmai... josef.pktd@gmai...
Tue Dec 7 14:51:52 CST 2010


On Tue, Dec 7, 2010 at 2:33 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
>
> On Tue, Dec 7, 2010 at 12:25 PM, Xunchen Liu <xunchen.liu@gmail.com> wrote:
>>
>> Hello,
>> I don't know if there is option to have weighting in least square fit?
>> attached is the code I use linalg.lstsq to fit 4 parameters out of 6
>> measurement.
>> Also, how can I read the uncertainty of each parameters fitted?
>
> There is no option for weights at the moment, nor for the covariance of the
> fitted parameters. We should fix that up someday, but at the moment you need
> to write your own implementation.

In writing your own implementation, you could use optimize curve_fit
as a pattern for the weight handling.

Or you just use scikits.statsmodels.WLS
http://pypi.python.org/pypi/scikits.statsmodels

Josef

>
> Chuck
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


More information about the SciPy-User mailing list