Note
Go to the end to download the full example code.
Create a maximum entropy order statistics distribution¶
Context¶
In this example we illustrate how to build the joint distribution of the
random vector which marginals are given
and such that:
(1)¶
The class MaximumEntropyOrderStatisticsDistribution
implements the joint
distribution of that maximizes the entropy of
.
See [fischer2017] for more details.
The distribution of is the distribution of the
order statistics of a
distribution
. We can write:
In that case, we do not know but we fix the marginals of its order
statistics distribution. If the
, then
is the
joint distribution of the
order statistics of
.
The marginals of must be compatible with the order constraint (1).
The library checks this compatibility by default. It requires that if
is the CDF of
, then they must verify:
(2)¶
which implies that if is the numerical range of
, then:
import openturns as ot
import openturns.viewer as otv
ot.ResourceMap.SetAsString("Contour-DefaultColorMapNorm", "rank")
Create the distributions :
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)
Display all figures
otv.View.ShowAll()