weighted mean; weighted standard error of the mean (sem)

C Barrington-Leigh cpblpublic at gmail.com
Thu Sep 9 20:36:34 EDT 2010


I am looking for some reaally basic statistical tools. I have some
sample data, some sample weights for those measurements, and I want to
calculate a mean and a standard error of the mean.

Here are obvious places to look:

numpy
scipy.stats
statsmodels

It seems to me that numpy's "mean" and "average" functions have their
names backwards. That is, often a mean is defined more generally than
average, and includes the possibility of weighting, but in this case
it is "average" that has a weights argument. Can these functions be
merged/renamed/deprecated in the future?  It's clear to me that "mean"
should allow for weights.

None of these modules, above, offer standard error of the mean which
incorporates weights. numpy's "sem" doesn't, and that's the closest
thing. numpy's "var" doesn't allow weights.
There aren't any weighted variances in the above modules.

Again, are there favoured codes for these functions? Can they be
incorporated appropriately in the future?

Most immediately, I'd love to get code for weighted sem. I'll write it
otherwise, but if I do I'd love to know whom to bug to get it
incorporated into numpy.sem ...

Thanks!

None of them have this basic function. Has anyone written one?



More information about the Python-list mailing list