001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.commons.math4.legacy.stat.ranking;
019
020/**
021 * Strategies for handling tied values in rank transformations.
022 * <ul>
023 * <li>SEQUENTIAL - Ties are assigned ranks in order of occurrence in the original array,
024 * for example (1,3,4,3) is ranked as (1,2,4,3)</li>
025 * <li>MINIMUM - Tied values are assigned the minimum applicable rank, or the rank
026 * of the first occurrence. For example, (1,3,4,3) is ranked as (1,2,4,2)</li>
027 * <li>MAXIMUM - Tied values are assigned the maximum applicable rank, or the rank
028 * of the last occurrence. For example, (1,3,4,3) is ranked as (1,3,4,3)</li>
029 * <li>AVERAGE - Tied values are assigned the average of the applicable ranks.
030 * For example, (1,3,4,3) is ranked as (1,2.5,4,2.5)</li>
031 * <li>RANDOM - Tied values are assigned a random integer rank from among the
032 * applicable values. The assigned rank will always be an integer, (inclusively)
033 * between the values returned by the MINIMUM and MAXIMUM strategies.</li>
034 * </ul>
035 *
036 * @since 2.0
037 */
038public enum TiesStrategy {
039
040    /** Ties assigned sequential ranks in order of occurrence. */
041    SEQUENTIAL,
042
043    /** Ties get the minimum applicable rank. */
044    MINIMUM,
045
046    /** Ties get the maximum applicable rank. */
047    MAXIMUM,
048
049    /** Ties get the average of applicable ranks. */
050    AVERAGE,
051
052    /** Ties get a random integral value from among applicable ranks. */
053    RANDOM
054}