[alexandria-devel] generic mean, variance, median, standard-deviation
Tamas Papp
tkpapp at gmail.com
Wed Jan 4 11:36:10 UTC 2012
On Fri, 30 Dec 2011, Nikodemus Siivola wrote:
> On 12 December 2011 18:06, Tamas Papp <tkpapp at gmail.com> wrote:
>
> > Would it be possible to make MEAN, VARIANCE, MEDIAN, and
> > STANDARD-DEVIATION generic? The concepts are meaningful for objects
> > other than sequences --- including arrays and random-variables (see
> > cl-random), sequences pre-sorted for easy quantile calculation, etc.
> > Currently I am shadowing these and redefining them as generic in some
> > of my libraries.
> >
> > I am happy to implement the change and send a patch.
>
> Sounds good to me.
I attach a patch for the mean and median, with a couple of new tests
and a utility function for displacing. I am happy to rewrite anything
to conform to the style of Alexandria, let me know if that is
necessary. I will submit a patch for the variance soon.
BTW, is anyone using the biased variance? When a similar statistic is
needed, it usually makes more sense to calculate the sum of squared
errors (from the mean), and variance could always give the "unbiased"
(/ sse (1- n)) statistic and have no keyword arguments. Just a
thought.
Best,
Tamas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Made-MEAN-and-MEDIAN-generic-added-DISPLACE-ARRAY.patch
Type: text/x-diff
Size: 4868 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/alexandria-devel/attachments/20120104/3576185d/attachment.patch>
More information about the alexandria-devel
mailing list