I'm using Python's statsmodels to perform a weighted linear regression. Since this is my first time with this module, I ran some basic tests.
Doing these, I find that errors on the parameters are independent of the weight. This doesn't fit my naive expectation (that larger error bars would produce a more uncertain result), or the definition I've seen in nonlinear fitting, which generally uses the weighted Hessian to report the uncertainty of the parameters.
I couldn't find an explicit description of the calculation of the parameter-errors (either in the statsmodels docs or support pages). I've posted on
Minimal code:
import statsmodels.api as sm
escale = 1
xvals = np.arange(0,11)yvals = xvals**2 # dummy nonlinear y-dataevals = escale*np.sqrt(yvals + escale) # errorbars
X = sm.add_constant(xvals) # to get intercept termmodel = sm.WLS(yvals, X, 1.0/evals**2) # weight inverse to errorresult = model.fit()
print "escale = ", escaleprint "fit = ", result.paramsprint "err = ", result.bse # same value independent of escale