# coyote: CGPERCENTILES

- coyote/Mathematics
- [Source code]

Description

      This program calculates user-specified percentiles of a data set.
      A percentile is the value of a variable below which a certain percent
      of observations fall. In other words, 75% of the values in a data set
      fall below the 75th percentile of the data. Computing percentiles is
      really nothing more than counting in a sorted input array. A box-and-whisker
      plot usually will display the 25th, 50th, and 75th percentiles.
      A `commercial version <http://www.idlcoyote.com/coyotestore/index.php?main_page=product_info&cPath=2&products_id=196>`
      of this program, containing a DIMENSION keyword, can be purchased from the Coyote Store. The
      DIMENSION keyword allows the user to calculate the percentiles over a particular dimension
      of a multi-dimensional data set.

Categories

      Math

Returns

      The return value is either a scalar or vector of data values corresponding to
      the number of percentiles asked for with the `Percentiles` keyword, or a -1 if
      there is an error in the program.

Params

      data: in, required
           The data from which percentiles are desired. A vector or an array.

Keywords

      percentiles: in, optional, type=float
           Set this keyword to a scalar or vector of values between 0.0 and 1.0
           to indicate the percentile desired. A value of 0.5 indicates the 50th
           percentile. Default value is [0.25, 0.50, 0.75].

Examples

      To return percentile values for 0.25, 0.50, and 0.75 of a data set::
         IDL> data = Randomu(3L, 100) * 100
         IDL> Print, cgPercentiles(data, Percentiles=[0.25, 0.5, 0.75])
                  27.4920      45.3172      69.3138

Author

      FANNING SOFTWARE CONSULTING::
         David W. Fanning
         1645 Sheely Drive
         Fort Collins, CO 80526 USA
         Phone: 970-221-0438
         E-mail: david@idlcoyote.com
         Coyote's Guide to IDL Programming: http://www.idlcoyote.com

History

      Change History::
         Written, 3 June 2013 by David W. Fanning.

Copyright

      Copyright (c) 2013, Fanning Software Consulting, Inc.