A new version of Collections was added to project The Inbox: http://source.squeak.org/inbox/Collections-LM.1047.mcz
==================== Summary ====================
Name: Collections-LM.1047 Author: LM Time: 22 March 2024, 12:41:45.48151 pm UUID: 2a45afd6-49ba-4136-8d68-bc2661b6667f Ancestors: Collections-ct.1046
These statistical functions can be quite useful for data analysis.
=============== Diff against Collections-ct.1046 ===============
Item was added: + ----- Method: Collection>>sampleStandardDeviation (in category 'math functions') ----- + sampleStandardDeviation + + ^ self sampleVariance sqrt!
Item was added: + ----- Method: Collection>>sampleVariance (in category 'math functions') ----- + sampleVariance + + ^ self totalSumOfSquares / (self size - 1)!
Item was added: + ----- Method: Collection>>standardDeviation (in category 'math functions') ----- + standardDeviation + + ^ self variance sqrt!
Item was added: + ----- Method: Collection>>standardError (in category 'math functions') ----- + standardError + "Unknown, so use the usual statistical estimate." + ^ (self sampleVariance / self size) sqrt!
Item was added: + ----- Method: Collection>>totalSumOfSquares (in category 'math functions') ----- + totalSumOfSquares + + | average | + average := self average. + ^ (self collect: [:element | (element - average) squared]) sum!
Item was added: + ----- Method: Collection>>variance (in category 'math functions') ----- + variance + + ^ self totalSumOfSquares / self size!
Could you speed up #totalSumOfSquares by using a single loop or at least #detectSum: to avoid additional instantiations? Also, you could override this method on FloatArray and use #dot: for greater speed. Otherwise, +1. :-)
Best, Christoph
________________________________ From: commits@source.squeak.org commits@source.squeak.org Sent: Friday, March 22, 2024 12:41:46 PM To: squeak-dev@lists.squeakfoundation.org squeak-dev@lists.squeakfoundation.org Subject: [squeak-dev] The Inbox: Collections-LM.1047.mcz
A new version of Collections was added to project The Inbox: http://source.squeak.org/inbox/Collections-LM.1047.mcz
==================== Summary ====================
Name: Collections-LM.1047 Author: LM Time: 22 March 2024, 12:41:45.48151 pm UUID: 2a45afd6-49ba-4136-8d68-bc2661b6667f Ancestors: Collections-ct.1046
These statistical functions can be quite useful for data analysis.
=============== Diff against Collections-ct.1046 ===============
Item was added: + ----- Method: Collection>>sampleStandardDeviation (in category 'math functions') ----- + sampleStandardDeviation + + ^ self sampleVariance sqrt!
Item was added: + ----- Method: Collection>>sampleVariance (in category 'math functions') ----- + sampleVariance + + ^ self totalSumOfSquares / (self size - 1)!
Item was added: + ----- Method: Collection>>standardDeviation (in category 'math functions') ----- + standardDeviation + + ^ self variance sqrt!
Item was added: + ----- Method: Collection>>standardError (in category 'math functions') ----- + standardError + "Unknown, so use the usual statistical estimate." + ^ (self sampleVariance / self size) sqrt!
Item was added: + ----- Method: Collection>>totalSumOfSquares (in category 'math functions') ----- + totalSumOfSquares + + | average | + average := self average. + ^ (self collect: [:element | (element - average) squared]) sum!
Item was added: + ----- Method: Collection>>variance (in category 'math functions') ----- + variance + + ^ self totalSumOfSquares / self size!
squeak-dev@lists.squeakfoundation.org