On Fri, 30 Dec 2011, Nikodemus Siivola wrote:
On 12 December 2011 18:06, Tamas Papp tkpapp@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