Home | History | Annotate | Download | only in ranking
      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.math.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  * @version $Revision: 981332 $ $Date: 2010-08-02 00:24:31 +0200 (lun. 02 aot 2010) $
     38  */
     39 public enum TiesStrategy {
     40 
     41     /** Ties assigned sequential ranks in order of occurrence */
     42     SEQUENTIAL,
     43 
     44     /** Ties get the minimum applicable rank */
     45     MINIMUM,
     46 
     47     /** Ties get the maximum applicable rank */
     48     MAXIMUM,
     49 
     50     /** Ties get the average of applicable ranks */
     51     AVERAGE,
     52 
     53     /** Ties get a random integral value from among applicable ranks */
     54     RANDOM
     55 }
     56