[Numpy-discussion] weighted mean; weighted standard error of the mean (sem)
Thu Sep 9 21:39:25 CDT 2010
On Thu, Sep 9, 2010 at 10:22 PM, cpblpublic <email@example.com> wrote:
> 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:
> 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.
I think of weighted mean and weighted average, pretty much as
synonyms, changing names would break backwards compatibility without
any real benefit, in my opinion.
> None of these modules, above, offer standard error of the mean which
> incorporates weights. scipy.stats.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.
for weighted statistics, I usually refer to ticket 604
but I didn't see weighted sem in it
> 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 it might be crude and dumb...
just a thought, I still have to check the details:
Estimating statsmodels.WLS with just a constant should give all the
result statistics on the mean, e.g. bse for variance of constant, t()
> Chris Barrington-Leigh
> NumPy-Discussion mailing list
More information about the NumPy-Discussion