Create a maximum entropy order statistics distribution

Context

In this example we illustrate how to build the joint distribution of the random vector \inputRV = (X_1, \dots, X_n) which marginals are given and such that:

(1)X_1 \leq \dots \leq X_n \quad \mbox{almost surely}.

The class MaximumEntropyOrderStatisticsDistribution implements the joint distribution of \inputRV that maximizes the entropy of \inputRV. See [fischer2017] for more details.

The distribution of \inputRV is the distribution of the n order statistics of a distribution Y. We can write:

(X_1, \dots, X_n) \sim (Y_{(1)}, \dots, Y_{(n)})

In that case, we do not know Y but we fix the marginals of its order statistics distribution. If the X_i \sim \beta(i, n-i+1), then \inputRV is the joint distribution of the n order statistics of Y \sim \cU([0,1]).

The marginals of \inputRV must be compatible with the order constraint (1). The library checks this compatibility by default. It requires that if F_i is the CDF of X_i, then they must verify:

(2)F_1 \geq F_2 \geq \dots \geq F_n

which implies that if [a_i, b_i] is the numerical range of X_i, then:

a_i \leq a_{i+1}\\
b_i \leq b_{i+1}

import openturns as ot
import openturns.viewer as otv

ot.ResourceMap.SetAsString("Contour-DefaultColorMapNorm", "rank")

Create the distributions X_i:

coll = [ot.Beta(1.5, 1.7, 0.0, 1.0), ot.Beta(2.0, 2.3, 0.5, 1.2)]

Create the joint order statistics distribution with maximum entropy: the creation is a success, which means that the marginals are compatible with the order constraint (1) and fulfill (2).

jointDist = ot.MaximumEntropyOrderStatisticsDistribution(coll)

Draw a sample: the components are well ordered.

x_sample = jointDist.getSample(10)
print(x_sample)
    [ X0        X1        ]
0 : [ 0.573802  0.640331  ]
1 : [ 0.0561493 1.08765   ]
2 : [ 0.860948  0.87137   ]
3 : [ 0.304464  0.722877  ]
4 : [ 0.36928   0.988477  ]
5 : [ 0.306281  0.939162  ]
6 : [ 0.620259  0.752213  ]
7 : [ 0.908716  0.935521  ]
8 : [ 0.118611  0.64981   ]
9 : [ 0.379123  0.737645  ]

Draw PDF

graph = jointDist.drawPDF()
contour = graph.getDrawable(0).getImplementation()
contour.setIsFilled(True)
contour.buildDefaultLevels(50)
graph.setDrawable(0, contour)
graph.setTitle("PDF of the Maximum Entropy Order Statistics Distribution")
view = otv.View(graph)
PDF of the Maximum Entropy Order Statistics Distribution

Display all figures

otv.View.ShowAll()