chaospy.PERT

class chaospy.PERT(lower, mode, upper, gamma=4)[source]

Program Evaluation and Review Technique (PERT) Distribution.

Defined by its mean:

\mu = \frac{lower + gamma*mode + upper}{2 + gamma}

Normal PERT for gamma=4. Other values results in the so called modified-PERT distribution.

Args:
lower (float):

The lower bounds for the distribution.

mode (float, Distribution):

The mode of the distribution.

upper (float):

The upper bounds for the distribution.

gamma (flat, Distribution):

Modify the PERT distribution to make more emphasis on the distribution mode instead of the distribution tails.

Examples:
>>> distribution = chaospy.PERT(-1, 0, 1)
>>> distribution
PERT(-1, 0, 1)
>>> uloc = numpy.linspace(0, 1, 6)
>>> uloc
array([0. , 0.2, 0.4, 0.6, 0.8, 1. ])
>>> xloc = distribution.inv(uloc)
>>> xloc.round(3)
array([-1.   , -0.347, -0.107,  0.107,  0.347,  1.   ])
>>> numpy.allclose(distribution.fwd(xloc), uloc)
True
>>> distribution.pdf(xloc).round(3)
array([0.   , 0.726, 0.916, 0.916, 0.726, 0.   ])
>>> distribution.sample(4).round(3)
array([ 0.167, -0.479,  0.622, -0.019])
>>> distribution.mom(1).round(4)
0.0
>>> distribution.ttr([0, 1, 2, 3]).round(4)
array([[0.    , 0.    , 0.    , 0.    ],
       [0.1429, 0.1429, 0.1905, 0.2121]])
__init__(lower, mode, upper, gamma=4)[source]

Distribution initializer.

In addition to assigning some object variables, also checks for some consistency issues.

Args:
parameters (Optional[Distribution[str, Union[ndarray, Distribution]]]):

Collection of model parameters.

dependencies (Optional[Sequence[Set[int]]]):

Dependency identifiers. One collection for each dimension.

rotation (Optional[Sequence[int]]):

The order of which to resolve dependencies.

exclusion (Optional[Sequence[int]]):

Distributions that has been “taken out of play” and therefore can not be reused other places in the dependency hierarchy.

repr_args (Optional[Sequence[str]]):

Positional arguments to place in the object string representation. The repr output will then be: <class name>(<arg1>, <arg2>, …).

Raises:
StochasticallyDependentError:

For dependency structures that can not later be rectified. This include under-defined distributions, and inclusion of distributions that should be exclusion.

Methods

pdf(x_data[, decompose, allow_approx, step_size])

Probability density function.

cdf(x_data)

Cumulative distribution function.

fwd(x_data)

Forward Rosenblatt transformation.

inv(q_data[, max_iterations, tollerance])

Inverse Rosenblatt transformation.

sample([size, rule, antithetic, ...])

Create pseudo-random generated samples.

mom(K[, allow_approx])

Raw statistical moments.

ttr(kloc)

Three terms relation's coefficient generator.

Attributes

interpret_as_integer

Flag indicating that return value from the methods sample, and inv should be interpreted as integers instead of floating point.

lower

Lower bound for the distribution.

stochastic_dependent

True if distribution contains stochastically dependent components.

upper

Upper bound for the distribution.