## .\

# cgpercentiles.pro

## top cgPercentiles

Math

`result = cgPercentiles(data [, Dimension=integer] [, 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. This is a
commercial version of the cgPercentiles program in the Coyote Library and
contains a `Dimension`

keyword to allow calculations over a single dimension
of a multiple dimension data set.

This program set can be purchased from the Coyote Store.

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

- Dimension in optional type=integer
Set this keyword to perform the percentile calculation over this dimension of the input data. The result will be an array that is the size of the percentilies vector in X and the size of this dimension of the data in Y.

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

```
IDL> data = Indgen(15, 10, 5)
IDL> Print, cgPercentiles(data, Percentiles=[0.25, 0.5, 0.75], Dimension=3)
37.0000 75.0000 112.000
187.000 225.000 262.000
337.000 375.000 412.000
487.000 525.000 562.000
637.000 675.000 712.000
```

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

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

- History:
Change History:

`Written, 3 June 2013 by David W. Fanning. Added DIMENSION keyword. 11 November 2013. DWF.`

## File attributes

Modification date: | Mon Nov 11 10:48:55 2013 |

Lines: | 194 |

Docformat: | rst rst |