@@ -270,12 +270,24 @@ DataSeries >> collectWithNotNils: aBlock [
270270{ #category : #' math functions' }
271271DataSeries >> correlationWith: otherSeries [
272272 " Calculate the Pearson correlation coefficient between self and the other series"
273- ^ self correlationWith: otherSeries using: DataPearsonCorrelationMethod
273+
274+ " ((#(1 2 4) asDataSeries) correlationWith: (#(2 4 8) asDataSeries)) >>> 1."
275+
276+ " ((#(1 2 4) asDataSeries) correlationWith: (#(-3 -6 -12) asDataSeries)) >>> -1."
277+
278+ ^ self
279+ correlationWith: otherSeries
280+ using: DataPearsonCorrelationMethod
274281]
275282
276283{ #category : #' math functions' }
277284DataSeries >> correlationWith: otherSeries using: aCorrelationCoefficient [
278285 " Calculate the correlation coefficient between self and the other series using the given method"
286+
287+ " ((#(1 2 4) asDataSeries) correlationWith: (#(2 4 8) asDataSeries) using: DataPearsonCorrelationMethod) >>> 1."
288+
289+ " ((#(1 2 4) asDataSeries) correlationWith: (#(-3 -6 -12) asDataSeries) using: DataPearsonCorrelationMethod) >>> -1."
290+
279291 ^ aCorrelationCoefficient between: self and : otherSeries
280292]
281293
@@ -627,6 +639,12 @@ DataSeries >> last [
627639
628640{ #category : #' math functions' }
629641DataSeries >> log: base [
642+ " Returns a data series containing the logarithm of each value in the receiver using the specified base."
643+
644+ " (#(1 2 4 8 16) asDataSeries log: 2) >>> (#(0.0 1.0 2.0 3.0 4.0) asDataSeries)"
645+
646+ " (#(1 10 100) asDataSeries log: 10) >>> (#(0.0 1.0 2.0) asDataSeries)"
647+
630648 ^ self collect: [ :each | each log: base ]
631649]
632650
0 commit comments