[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding an aggregate for variance

From: John Darrington
Subject: Re: Adding an aggregate for variance
Date: Wed, 14 Oct 2020 08:47:06 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

On Tue, Oct 13, 2020 at 09:47:18PM +0200, Jose E. Marchesi wrote:
     Hi John.
     Still, I see nothing wrong in having support for simple aggregates like
     average, count, variance and the like.  In their simplicitly, they can
     be certainly useful for cases where using a full-fledged statistical
     analysis tool would be overkill.

Fair enough.   However average, count and variance are all just special
cases of what statisticians call "moments" [1], so instead of reimplementing
each one from scratch, why not save yourself several hundred lines of code
and simply implement a "moment" aggregate (with aliases if you like) which
will calculate any arbitrary moment?  As a bonus, then you'll skewness and
kurtosis for free.


[1] https://en.wikipedia.org/wiki/Moment_(mathematics)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]