View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.math4.legacy.stat.ranking;
19  
20  /**
21   * Strategies for handling tied values in rank transformations.
22   * <ul>
23   * <li>SEQUENTIAL - Ties are assigned ranks in order of occurrence in the original array,
24   * for example (1,3,4,3) is ranked as (1,2,4,3)</li>
25   * <li>MINIMUM - Tied values are assigned the minimum applicable rank, or the rank
26   * of the first occurrence. For example, (1,3,4,3) is ranked as (1,2,4,2)</li>
27   * <li>MAXIMUM - Tied values are assigned the maximum applicable rank, or the rank
28   * of the last occurrence. For example, (1,3,4,3) is ranked as (1,3,4,3)</li>
29   * <li>AVERAGE - Tied values are assigned the average of the applicable ranks.
30   * For example, (1,3,4,3) is ranked as (1,2.5,4,2.5)</li>
31   * <li>RANDOM - Tied values are assigned a random integer rank from among the
32   * applicable values. The assigned rank will always be an integer, (inclusively)
33   * between the values returned by the MINIMUM and MAXIMUM strategies.</li>
34   * </ul>
35   *
36   * @since 2.0
37   */
38  public enum TiesStrategy {
39  
40      /** Ties assigned sequential ranks in order of occurrence. */
41      SEQUENTIAL,
42  
43      /** Ties get the minimum applicable rank. */
44      MINIMUM,
45  
46      /** Ties get the maximum applicable rank. */
47      MAXIMUM,
48  
49      /** Ties get the average of applicable ranks. */
50      AVERAGE,
51  
52      /** Ties get a random integral value from among applicable ranks. */
53      RANDOM
54  }