# Median

## Median(X, *I*)

Computes the sample median. Equivalent to GetFract(X, 50%).

Without an index parameter, computes the sample median of the uncertainty sample (along the Run index). With an index, computes the sample median along index «I».

The median is the "middle" value of a sample, such that half the samples are less or equal to than the median and half greater than or equal to the median. It is also called the 50%-fractile or 50^{th}-percentile.

## Optional parameters

### W

A weighting on the data points. Median can compute the percentile based on an unequal weighting, such that some points carry more weight than others. If specified, «w» should be indexed by «I» (or by Run, if «I» is omitted). When «w» and «I» are both omitted, Median uses the global weighting specified by the system variable SampleWeighting.

### Discrete

A boolean parameter that explicitly controls whether the data is treated as discrete or continuous. Without this, various heuristic rules are used (see below).

### Domain

This is seldom used by Analytica modelers, although it could be in rare cases. Analytica itself makes use of this parameter internally. A variable containing a domain attribute can be specified here to indicate the set of possible values. Analytica can use that to figure out whether the value is discrete or continuous, and in the discrete case, it will use this domain to determine the ordering between possible values (which impacts the resulting percentile value).

## Library

Statistical Functions

## Additional Details

The median is well-defined for numeric as well as non-numeric values. Continuous and categorical medians are handled slightly differently. The domain attribute can be used to control the ordering of categorical values. In some cases, it can be ambiguous whether numeric samples are to be treated as continuous or discrete numeric. Median can also be used to compute the weighted median. See the description for GetFract for additional details on all these variations.

Enable comment auto-refresher