TiesStrategy.java

  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.  *      https://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.  * This is not the original file distributed by the Apache Software Foundation
  19.  * It has been modified by the Hipparchus project
  20.  */

  21. package org.hipparchus.stat.ranking;

  22. /**
  23.  * Strategies for handling tied values in rank transformations.
  24.  * <ul>
  25.  * <li>SEQUENTIAL - Ties are assigned ranks in order of occurrence in the original array,
  26.  * for example (1,3,4,3) is ranked as (1,2,4,3)</li>
  27.  * <li>MINIMUM - Tied values are assigned the minimum applicable rank, or the rank
  28.  * of the first occurrence. For example, (1,3,4,3) is ranked as (1,2,4,2)</li>
  29.  * <li>MAXIMUM - Tied values are assigned the maximum applicable rank, or the rank
  30.  * of the last occurrence. For example, (1,3,4,3) is ranked as (1,3,4,3)</li>
  31.  * <li>AVERAGE - Tied values are assigned the average of the applicable ranks.
  32.  * For example, (1,3,4,3) is ranked as (1,2.5,4,2.5)</li>
  33.  * <li>RANDOM - Tied values are assigned a random integer rank from among the
  34.  * applicable values. The assigned rank will always be an integer, (inclusively)
  35.  * between the values returned by the MINIMUM and MAXIMUM strategies.</li>
  36.  * </ul>
  37.  *
  38.  */
  39. public enum TiesStrategy {

  40.     /** Ties assigned sequential ranks in order of occurrence */
  41.     SEQUENTIAL,

  42.     /** Ties get the minimum applicable rank */
  43.     MINIMUM,

  44.     /** Ties get the maximum applicable rank */
  45.     MAXIMUM,

  46.     /** Ties get the average of applicable ranks */
  47.     AVERAGE,

  48.     /** Ties get a random integral value from among applicable ranks */
  49.     RANDOM
  50. }