bundles / scipy latest / scipy / stats / _distribution_infrastructure / OrderStatisticDistribution
ABCMeta
scipy.stats._distribution_infrastructure:OrderStatisticDistribution
Signature
def OrderStatisticDistribution ( dist , / , * args , r , n , ** kwargs ) Members
Summary
Probability distribution of an order statistic
Extended Summary
An instance of this class represents a random variable that follows the distribution underlying the order statistic of a sample of observations of a random variable .
Parameters
dist: `ContinuousDistribution`The random variable
n: array_likeThe (integer) sample size
r: array_likeThe (integer) rank of the order statistic
Notes
If we make observations of a continuous random variable and sort them in increasing order , is known as the order statistic.
If the PDF, CDF, and CCDF underlying math:X are denoted , , and , respectively, then the PDF underlying math:X_{(r)} is given by:
The CDF and other methods of the distribution underlying are calculated using the fact that , where is a standard uniform random variable, and that the order statistics of observations of U follow a beta distribution, .
Examples
Suppose we are interested in order statistics of samples of size five drawn from the standard normal distribution. Plot the PDF underlying the fourth order statistic and compare with a normalized histogram from simulation.import numpy as np import matplotlib.pyplot as plt from scipy import stats from scipy.stats._distribution_infrastructure import OrderStatisticDistribution X = stats.Normal() data = X.sample(shape=(10000, 5)) ranks = np.sort(data, axis=1) Y = OrderStatisticDistribution(X, r=4, n=5) ax = plt.gca()✓
Y.plot(ax=ax) ax.hist(ranks[:, 3], density=True, bins=30)✗
plt.show()
✓
Aliases
-
scipy.stats._distribution_infrastructure.OrderStatisticDistribution