diff --git a/src/FSharp.Stats/Correlation.fs b/src/FSharp.Stats/Correlation.fs index 3b095c14..3eab8949 100644 --- a/src/FSharp.Stats/Correlation.fs +++ b/src/FSharp.Stats/Correlation.fs @@ -283,15 +283,21 @@ module Correlation = |> spearmanOfPairs /// Kendall Correlation Coefficient - /// - /// - /// - /// + /// Computes Kendall rank correlation coefficient between two sequences of observations. + /// The first sequence of observations. + /// The second sequence of observations. + /// Kendall rank correlation coefficient of setA and setB /// /// + /// let x = [5.05;6.75;3.21;2.66] + /// let y = [1.65;26.5;-0.64;6.95] + /// + /// Seq.kendall x y // evaluates to 0.3333333333 /// /// - let kendall (setA:_[]) (setB:_[]) = + let kendall seq1 seq2 = + let setA = Array.ofSeq seq1 + let setB = Array.ofSeq seq2 let lengthArray = Array.length setA let inline kendallCorrFun (setA:_[]) (setB:_[]) = let rec loop i j cCon cDisc cTieA cTieB cPairs = @@ -440,7 +446,7 @@ module Correlation = /// /// A function applied to transform each element of the sequence into a tuple of paired observations. /// The input sequence. - /// The kendall correlation coefficient. + /// The Biweighted Midcorrelation. /// /// /// // To get the correlation between A and B observations: