Since all of the variables in mcerp are statistical distributions, they are created internally using the scipy.stats distributions. There are also some convenience constructors that should make defining a distribution easier, though it’s not necessary to use them. See the source code of the UncertainVariable class for info that describes how to construct many of the most common statistical continuous and discrete distributions using the scipy.stats distributions (and some others not currently part of scipy.stats).
To track variables that may share the same distribution, each of the constructors below accepts an optional tag=... kwarg that can be accessed at anytime using x.tag.
Now, if you are like me, the easier the syntax–the better, thus, here are a set of equivalent constructors that I’ve found to be easier to use for the most common kinds of distributions (the location, scale, and shape parameters are described in their respective web pages and the source code):
Continuous Distributions | |
Beta(alpha, beta, [low, high]) | Beta distribution |
Bradford(q, [low, high]) | Bradford distribution |
Burr(c, k) | Burr distribution |
ChiSquared(k) or Chi2(k) | Chi-squared distribution |
Erf(h) | Error Function distribution |
Erlang(m, b) | Erlang distribution |
Exponential(lamda) or Exp(lamda) | Exponential distribution |
ExtValueMax(mu, sigma) or EVMax(mu, sigma) | Extreme Value Maximum distribution |
ExtValueMin(mu, sigma) or EVMin(mu, sigma) | Extreme Value Minimum distribution |
Fisher(d1, d2) or F(d1, d2) | F-distribution |
Gamma(k, theta) | Gamma distribution |
LogNormal(mu, sigma) or LogN(mu, sigma) | Log-normal distribution |
Normal(mu, sigma) or N(mu, sigma) | Normal distribution |
Pareto(q, a) (first kind) | Pareto distribution |
Pareto2(q, b) (second kind) | Pareto2 distribution |
PERT(low, peak, high) | PERT distribution |
StudentT(v) or T(v) | T-distribution |
Triangular(low, peak, high) or Tri(low, peak, high) | Triangular distribution |
Uniform(low, high) or U(low, high) | Uniform distribution |
Weibull(lamda, k) or Weib(lamda, k) | Weibull distribution |
Discrete Distributions | |
Bernoulli(p) or Bern(p) | Bernoulli distribution |
Binomial(n, p) or B(n, p) | Binomial distribution |
Geometric(p) or G(p) | Geometric distribution |
Hypergeometric(N, n, K) or H(N, n, K) | Hypergeometric distribution |
Poisson(lamda) or Pois(lamda) | Poisson distribution |
For example, the following constructions are equivalent:
# explicitly calling out the scipy.stats distribution
>>> import scipy.stats as ss
>>> x = uv(ss.norm(loc=10, scale=1))
# using a built-in constructor
>>> x = Normal(10, 1)
# and if there's a short-name alias available
>>> x = N(10, 1)
From my experience, the first option can be tedious and difficult to work with, but it does allow you to input any distribution defined in the scipy.stats sub-module, both continuous and discrete, if you know how. For the most common distributions, the MCERP constructors are hard to beat. If you feel like another distribution should be included in the “common” list, let me know!