[Numpy-discussion] Computing Simple Statistics When Only they Frequency Distribution is Known

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Nov 27 22:14:25 EST 2009


On Fri, Nov 27, 2009 at 9:47 PM, Wayne Watson
<sierra_mtnview at sbcglobal.net> wrote:
> How do I compute avg, std dev, min, max and other simple stats if I only
> know the frequency distribution?

If you are willing to assign to all observations in a bin the value at
the bin midpoint, then you could do it with weights in the statistics
calculations. However, numpy.average is, I think, the only statistic
that takes weights. min max are independent of weight, but std and var
need to be calculated indirectly.

If you need more stats with weights, then the attachment in
http://projects.scipy.org/scipy/ticket/604  is a good start.

Josef


>
> --
>           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>
>             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
>
>                   350 350 350 350 350 350 350 350 350 350
>                     Make the number famous. See 350.org
>            The major event has passed, but keep the number alive.
>
>                    Web Page: <www.speckledwithstars.net/>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list