Engee documentation

Order Statistics

The th Order Statistic of a random sample of size from a univariate distribution is the th element after sorting in increasing order. As a special case, the first and th order statistics are the minimum and maximum of the sample, while for odd , the th entry is the sample median.

Given any univariate distribution and the sample size , we can construct the distribution of its th order statistic:

OrderStatistic{D<:UnivariateDistribution,S<:ValueSupport} <: UnivariateDistribution{S}

The distribution of an order statistic from IID samples from a univariate distribution.

OrderStatistic(dist::UnivariateDistribution, n::Int, rank::Int; check_args::Bool=true)

Construct the distribution of the rank th order statistic from n independent samples from dist.

The th order statistic of a sample is the th element of the sorted sample. For example, the 1st order statistic is the sample minimum, while the th order statistic is the sample maximum.

If is the probability density (mass) function of dist with distribution function , then the probability density function of the order statistic for continuous dist is

and the probability mass function of the order statistic for discrete dist is

where is the largest element in the support of dist less than .

For the joint distribution of a subset of order statistics, use JointOrderStatistics instead.

Examples

OrderStatistic(Cauchy(), 10, 1)              # distribution of the sample minimum
OrderStatistic(DiscreteUniform(10), 10, 10)  # distribution of the sample maximum
OrderStatistic(Gamma(1, 1), 11, 5)           # distribution of the sample median

If we are interested in more than one order statistic, for continuous univariate distributions we can also construct the joint distribution of order statistics:

JointOrderStatistics <: ContinuousMultivariateDistribution

The joint distribution of a subset of order statistics from a sample from a continuous univariate distribution.

JointOrderStatistics(
    dist::ContinuousUnivariateDistribution,
    n::Int,
    ranks=Base.OneTo(n);
    check_args::Bool=true,
)

Construct the joint distribution of order statistics for the specified ranks from an IID sample of size n from dist.

The th order statistic of a sample is the th element of the sorted sample. For example, the 1st order statistic is the sample minimum, while the th order statistic is the sample maximum.

ranks must be a sorted vector or tuple of unique Ints between 1 and n.

For a single order statistic, use OrderStatistic instead.

Examples

JointOrderStatistics(Normal(), 10)           # Product(fill(Normal(), 10)) restricted to ordered vectors
JointOrderStatistics(Cauchy(), 10, 2:9)      # joint distribution of all but the extrema
JointOrderStatistics(Cauchy(), 10, (1, 10))  # joint distribution of only the extrema