Hi,
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.
Best,
Tamas
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.
Cheers,
-- nikodemus
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
On 4 January 2012 13:36, Tamas Papp tkpapp@gmail.com wrote:
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.
Thanks, merged.
I tweaked it a bit, though, mostly to support generalized sequences, and MEAN also to deal with fill pointers correctly.
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.
No idea, really.
Cheers,
-- Nikodemus
On Fri, 20 Jan 2012, Nikodemus Siivola wrote:
On 4 January 2012 13:36, Tamas Papp tkpapp@gmail.com wrote:
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.
Thanks, merged.
Thanks. I attach a patch that introduces a saner argument convention to displace-array, factoring out flatten-array. Should have done this originally, sorry.
Best,
Tamas
alexandria-devel@common-lisp.net