# Fractiles

## Fractiles(x)

This function creates a probability distribution treating the elements of «x» as fractiles (percentiles, quartiles) with equal probability spacing. The terms "fractile", "percentile" and "quartile" are all synonymous, each in dominant use within their own academic fields of study. The first element of «x» is the zeroth fractile (i.e. minimum), the last element is the 1.0 fractile (100th percentile, i.e. maximum). If «x» has *n + 1* elements, the i-th value is the (i/n) fractile. The distribution is piecewise uniform -- that is, it assumes a uniform distribution between each pair of adjacent fractiles. The values of «x» must be numerical and ascending.

Declaration:

- Fractiles(x: number ...)

## Deprecation

From Analytica 4.0 through Analytica 5.0, this function is considered obsolete. If you have a distribution specified by a set of fractiles (percentiles, quartiles), it is usually best to use the CumDist funtion, which let's you specify an arbitrary (not just equal probability-spaced) fractiles, and interpolates the density function as linear between specified fractiles (or equivalently, interpolates the cumulative function as quadratic).

We may un-deprecate this function, with the Analytica 5.1 changes, at some point in the future. We haven't decided to do so yet.

## Examples

A distribution bounded by 10 and 100, with a median of 80, a 25th percentile of 30, and a 75th percentile of 90:

`Fractiles( 10, 30, 80, 90, 100 )`

or equivalently

`Fractiles( [10, 30, 80, 90, 100] )`

The first usage, without explicit square brackets, requires Analytica 5.1 or later.

## Comparison to CumDist

The basic difference between Fractiles and CumDist is that you specify the quartile levels when calling CumDist, whereas with Fractiles you are stuck with evenly spaced quartiles.

For example, these are equivalent:

`Fractiles( [0, 10, 50, 100, 200, 400] )`

`LocalIndex p := Sequence( 0, 100%, 20% ) Do CumDist( p, Array(p, [0, 10, 50, 100, 200, 400 ] ), p, smooth:false )`

## History

The Fractiles function has existed since the first release of Analytica, but was declared obsolete many years ago and removed from sight. It was recommended to use CumDist in its place instead, which also allows you to specify a distribution by its quartiles. The early function did not adhere to many of the conventions typical of other Analytica functions, and didn't use the modern Analytica parameter declarations, not did it work with Expression Assist.

In Analytica 5.1, the function was altered to use a repeated parameter for the fractiles. This creates a few syntactic changes that are not backward or forward compatible, but with are more consistent with general Analytica conventions. Here are some examples:

`Fractiles( [0, 10, 40, 80, 150, 200, 300 ] )`

{ Works with all releases }`Fractiles [0, 10, 40, 80, 150, 200, 300 ]`

{ No longer accepted starting Analytica 5.1 -- parens required }`Fractiles( 0, 10, 40, 80, 150, 200, 300 )`

{ Accepted in Analytica 5.1 or higher }`Fractiles( [0, 10, 40, 80, 150, 200, 300 ]/3 )`

{ No longer accepted starting in Analytica 5.1 }`Fractiles( ...[0, 10, 40, 80, 150, 200, 300 ]/3 )`

{ Analytica 5.1 replacement for the previous example, but requires Analytica 5.1 }

Enable comment auto-refresher