Distributions

Introduction

This module is used to define probability distributions. For computing polynomial Chaos expansions (see Polynomial Chaos Expansions), these will be input distributions into a forward model defining the stochastic variation of model parameters.

UncertainSCI currently supports the following types of random variables:

Tensorizations within a distribution are possible across these families by instantiating the distribution appropriately. Tensorizations across distributions is also possible, but requires individual instantiation of each distribution, followed by a constructor call to the TensorialDistribution class. (See TensorialDistribution)

E.g., a three-dimensional random variable \(Y = (Y_1, Y_2, Y_3)\) can have independent components, with the distribution of \(Y_1\) normal, that of \(Y_2\) beta, and that of \(Y_3\) exponential.

The distributions are located in the distributions.py file.

class UncertainSCI.distributions.BetaDistribution(alpha=None, beta=None, mean=None, stdev=None, dim=None, domain=None, bounds=None)

Constructs a Beta distribution object; supports multivariate distributions through tensorization. In one dimension, beta distributions have support on the real interval [0,1], with probability density function,

\[w(y;\alpha,\beta) := \frac{y^{\alpha-1} (1-y)^{\beta-1}} {B(\alpha,\beta)}, \hskip 20pt y \in (0,1),\]

where \(\alpha\) and \(\beta\) are positive real parameters that define the distribution, and \(B\) is the Beta function. Some special cases of note:

  • \(\alpha = \beta = 1\): the uniform distribution

  • \(\alpha = \beta = \frac{1}{2}\): the arcsine distribution

To generate this distribution on a general compact interval \([a,b]\), set the domain parameter below.

Instead of \((\alpha, \beta)\), a mean \(\mu\) and standard deviation :math:\sigma may be set. In this case, \((\mu, \sigma)\) must correspond to valid (i.e., positive) values of \((\alpha, \beta)\) on the interval [0,1], or else an error is raised.

Finally, this class supports tensorization: multidimensional distributions corresopnding to independent one-dimensional marginal distributions are supported. In the case of identically distributed marginals, the dim parameter can be set to the appropriate dimension. In case of non-identical marginals, an array or iterable can be input for \(\alpha, \beta, \mu, \sigma\).

Parameters:
  • alpha (float or iterable of floats, optional) – Shape parameter

  • 1. (associated to left-hand boundary. Defaults to) –

  • beta (float or iterable of floats, optional) – Shape parameter

  • 1.

  • mean (float or iterable of floats, optional) – Mean of the distribution.

  • None. (the distribution. Defaults to) –

  • stdev (float or iterable of floats, optional) – Standard deviation of

  • None.

  • dim (int, optional) – Dimension of the distribution. Defaults to None.

  • domain (numpy.ndarray or similar, of size 2 x dim, optional) – Compact

  • None (hypercube that is the support of the distribution. Defaults to) –

dim

Dimension of the distribution.

Type:

int

alpha

Shape parameter(s) alpha.

Type:

float or np.ndarray

beta

Shape parameter(s) beta.

Type:

float or np.ndarray

polys
Type:

JacobiPolynomials or list thereof

MC_samples(M=100)

Returns M Monte Carlo samples from the distribution.

cov()

Returns the (auto-)covariance matrix of the distribution.

mean()

Returns the mean of the distribution.

meanstdev_to_alphabeta(mu, stdev)

Returns alpha, beta given an input mean (mu) and standard deviation (stdev) for a Beta distribution on the interval [0, 1].

pdf(x)

Evaluates the probability density function (pdf) of the distribution at the input locations x.

stdev()

Returns the standard deviation of the distribution, if the distribution is one-dimensional. Raises an error if called for a multivariate distribution.

class UncertainSCI.distributions.ExponentialDistribution(flag=True, lbd=None, loc=None, mean=None, stdev=None, dim=None)
MC_samples(M=100)

Returns M Monte Carlo samples from the distribution.

cov()
mean()
meanloc_to_lbd(mu, loc)

Returns lbd given an input mean (mu) and location (loc) for a Exponential distribution

pdf(x)
stdev()

Returns the standard deviation of the distribution, if the distribution is one-dimensional. Raises an error if called for a multivariate distribution.

class UncertainSCI.distributions.NormalDistribution(mean=None, cov=None, dim=None)
MC_samples(M=100)

Returns M Monte Carlo samples from the distribution.

cov()
mean()
pdf(x)

Evaluates the probability density function (pdf) of the distribution at the input locations x.

stdev()

Returns the standard deviation of the distribution, if the distribution is one-dimensional. Raises an error if called for a multivariate distribution.

class UncertainSCI.distributions.DiscreteUniformDistribution(n=None, domain=None, dim=None)
MC_samples(M=100)

Returns M Monte Carlo samples from the distribution.

cov()
mean()
pmf(x)

Evaluates the probability mass function (pmf) of the distribution

stdev()

Returns the standard deviation of the distribution, if the distribution is one-dimensional. Raises an error if called for a multivariate distribution.

class UncertainSCI.distributions.TensorialDistribution(distributions=None, dim=None)
MC_samples(M=100)

Returns M Monte Carlo samples from the distribution