Create a random mixture of distributionsΒΆ

In this example we are going to build an affine combination of input random variables.

Y = 2 + 5 X_1 + X_2

This notion is different from the Mixture where the combination is made on the probability density functions and not on the univariate random variable.

In [8]:
from __future__ import print_function
import openturns as ot
In [15]:
# create the distributions associated to the input random variables
X1 = ot.Exponential(1.5)
X2 = ot.Normal(4.0, 1.0)
In [10]:
# offset
a0 = 2.0
In [11]:
# Create the weights
weight = [5.0, 1.0]
In [16]:
# create the affine combination
distribution = ot.RandomMixture([X1, X2], weight, a0)
distribution
Out[16]:

RandomMixture(Normal(mu = 6, sigma = 1) + Exponential(lambda = 0.3, gamma = 0))

In [13]:
# draw PDF
distribution.drawPDF()
Out[13]:
../../_images/examples_probabilistic_modeling_random_mixture_distribution_7_0.svg
In [14]:
# draw PDF
distribution.drawCDF()
Out[14]:
../../_images/examples_probabilistic_modeling_random_mixture_distribution_8_0.svg