[Numpy-discussion] Computing Simple Statistics When Only they Frequency Distribution is Known
Sat Nov 28 21:45:28 CST 2009
David Goldsmith wrote:
> On Fri, Nov 27, 2009 at 9:25 PM, Wayne Watson
> <email@example.com <mailto:firstname.lastname@example.org>>
> I actually wrote my own several days ago. When I began getting myself
> more familiar with numpy, I was hoping there would be an easy to use
> version in it for this frequency approach. If not, then I'll just
> with what I have. It seems something like this should be common.
> > If you need more stats with weights, then the attachment in
> > http://projects.scipy.org/scipy/ticket/604 is a good start.
> > Josef
> There is no need to "unwind": If Y(X) is the (unnormalized) freq.
> distr. of random variable/data X, start by computing y = Y/(Y.sum())
> (if Y is already normalized, skip this step). Then:
> av(X) = np.dot(X, y), sd(X) = np.sqrt(np.dot((X*X), y) - (av(X))^2),
> and higher moment statistics can be calculated utilizing similar
I was only illustrating a way that I would not consider, since the
hardware has already created the pdf. I've already coded it pretty much
as you have suggested. As I think I mention ed above, I'm a bit
surprised numpy doesn't provide the code you suggest as part of some
function. CalcSimplefromPDF(xvalues=mydatarray, avg=ture, minmax=true,
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/>
More information about the NumPy-Discussion