SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.descriptive.rank
Class Rank

java.lang.Object
  extended by com.numericalmethod.suanshu.stats.descriptive.rank.Rank

public class Rank
extends java.lang.Object

Rankin is a relationship between a set of items such that, for any two items, the first is either "ranked higher than", "ranked lower than" or "ranked equal to" the second. This is known as a weak order or total preorder of objects. It is not necessarily a total order of objects because two different objects can have the same ranking. The rankings themselves are totally ordered.

In statistics, "ranking" refers to the data transformation in which numerical or ordinal values are replaced by their rank when the data are sorted. It is important to note that ranks can sometimes have non-integer values for tied data values. Thus, in one way of treating tied data values, when there is an even number of copies of the same data value, the statistical rank (being the median rank of the tied data) can end in ½ or another fraction.

The R equivalent function is rank.

See Also:

Field Summary
 double s
          s = Σ(ti2 - ti)
 double t
          t = Σ(ti3 - ti)
 
Constructor Summary
Rank(double[] arr)
          Compute the sample ranks of the values using the machine epsilon as the tie threshold.
Rank(double[] values, double threshold)
          Compute the sample ranks of the values.
 
Method Summary
 double rank(int i)
          Get the rank of the element arr[i].
 double[] ranks()
          Get a copy of the ranks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

t

public final double t
t = Σ(ti3 - ti)


s

public final double s
s = Σ(ti2 - ti)

Constructor Detail

Rank

public Rank(double[] values,
            double threshold)
Compute the sample ranks of the values.

Parameters:
values - the values
threshold - the tie threshold. If successive elements of the sorted array differ by less than the threshold, they are treated as equal. We count the number of ties in each group.

Rank

public Rank(double[] arr)
Compute the sample ranks of the values using the machine epsilon as the tie threshold.

Parameters:
arr - the values
Method Detail

rank

public double rank(int i)
Get the rank of the element arr[i].

Parameters:
i - index to arr
Returns:
rank of arr[i]

ranks

public double[] ranks()
Get a copy of the ranks.

Returns:
a copy of int[] rank

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.