# Coyote Graphics Routines

## Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

# cgpercentiles.pro

## top cgPercentiles

Math

`result = cgPercentiles(data [, Percentiles=float])`

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 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.

### Return value

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.

### Parameters

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 information

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 ```

``` Written, 3 June 2013 by David W. Fanning. ```