Skip to content

Unify and fix rank module result types #183

@bvenn

Description

@bvenn

There are 4 ranking methods in FSharp.Stats.Rank:

example = [5,3,3,4,2]

  • rankFirst - when ties are present, rank them corresponding to the order of their appearance
    • result :int [] = [5,2,3,4,1]
  • rankMin - when ties are present, their rank correspond to the rank of the first occurrence
    • result :float [] = [5,2,2,4,1]
  • rankMax - when ties are present, their rank correspond to the rank of the last occurrence
    • result :float [] = [5,3,3,4,1]
  • rankAvg - when ties are present, their rank correspond to the average of all tie ranks
    • result :float [] = [5,2.5,2.5,4,1]
  1. By now, all functions except rankFirst result in float arrays. The only function where floats can occur is rankAvg. For harmonization I would suggest, that rankFirst as well should report a float array, although it would be a breaking change.

  2. There seems to be an issue, that ties are not ranked correct here:

    let minTies a _ = (float a + 1.)

    It seems the +1 increment belongs to rankMax rather than rankMin.
    EDIT 01/02/22: THIS WAS A TEMPORAL LOCAL ERROR!

A fix is on the way!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions