Example: Ranks

In this data from Hinkley (1977) note that the fourth and sixth observations are tied and that the third and twentieth are tied.
import com.imsl.stat.*;
import com.imsl.math.*;

public class RanksEx1 {
    public static void main(String args[]) {
        double x[] = {
            0.77, 1.74, 0.81, 1.20, 1.95, 1.20, 0.47, 1.43,
            3.37, 2.20, 3.00, 3.09, 1.51, 2.10, 0.52, 1.62,
            1.31, 0.32, 0.59, 0.81, 2.81, 1.87, 1.18, 1.35,
            4.75, 2.48, 0.96, 1.89, 0.90, 2.05};
            
            PrintMatrixFormat mf = new PrintMatrixFormat();
            mf.setNoRowLabels();
            mf.setNoColumnLabels();
            
            Ranks ranks = new Ranks();
            double score[] = ranks.getRanks(x);
            new PrintMatrix("The Ranks of the Observations - " +
            "Ties Averaged").print(mf, score);
            System.out.println();
            
            ranks = new Ranks();
            ranks.setTieBreaker(ranks.TIE_HIGHEST);
            score = ranks.getBlomScores(x);
            new PrintMatrix("The Blom Scores of the Observations - " +
            "Highest Score used in Ties").print(mf, score);
            System.out.println();
            
            ranks = new Ranks();
            ranks.setTieBreaker(ranks.TIE_LOWEST);
            score = ranks.getTukeyScores(x);
            new PrintMatrix("The Tukey Scores of the Observations - " +
            "Lowest Score used in Ties").print(mf, score);
            System.out.println();
            
            ranks = new Ranks();
            ranks.setTieBreaker(ranks.TIE_RANDOM);
            Random random = new Random();
            random.setSeed(123457);
            random.setMultiplier(16807);
            ranks.setRandom(random);
            score = ranks.getVanDerWaerdenScores(x);
            new PrintMatrix("The Van Der Waerden Scores of the " +
            "Observations - Ties untied by Random").print(mf, score);
    }
}

Output

The Ranks of the Observations - Ties Averaged
        
 5    
18    
 6.5  
11.5  
21    
11.5  
 2    
15    
29    
24    
27    
28    
16    
23    
 3    
17    
13    
 1    
 4    
 6.5  
26    
19    
10    
14    
30    
25    
 9    
20    
 8    
22    


The Blom Scores of the Observations - Highest Score used in Ties
          
-1.024  
 0.209  
-0.776  
-0.294  
 0.473  
-0.294  
-1.61   
-0.041  
 1.61   
 0.776  
 1.176  
 1.361  
 0.041  
 0.668  
-1.361  
 0.125  
-0.209  
-2.04   
-1.176  
-0.776  
 1.024  
 0.294  
-0.473  
-0.125  
 2.04   
 0.893  
-0.568  
 0.382  
-0.668  
 0.568  


The Tukey Scores of the Observations - Lowest Score used in Ties
          
-1.02   
 0.208  
-0.89   
-0.381  
 0.471  
-0.381  
-1.599  
-0.041  
 1.599  
 0.773  
 1.171  
 1.354  
 0.041  
 0.666  
-1.354  
 0.124  
-0.208  
-2.015  
-1.171  
-0.89   
 1.02   
 0.293  
-0.471  
-0.124  
 2.015  
 0.89   
-0.566  
 0.381  
-0.666  
 0.566  


The Van Der Waerden Scores of the Observations - Ties untied by Random
          
-0.989  
 0.204  
-0.753  
-0.287  
 0.46   
-0.372  
-1.518  
-0.04   
 1.518  
 0.753  
 1.131  
 1.3    
 0.04   
 0.649  
-1.3    
 0.122  
-0.204  
-1.849  
-1.131  
-0.865  
 0.989  
 0.287  
-0.46   
-0.122  
 1.849  
 0.865  
-0.552  
 0.372  
-0.649  
 0.552  

Link to Java source.