chaospy.Perc

chaospy.Perc(poly, q, dist, sample=10000, **kws)[source]

Percentile function.

Note that this function is an empirical function that operates using Monte Carlo sampling.

Args:
poly (numpoly.ndpoly):

Polynomial of interest.

q (numpy.ndarray):

positions where percentiles are taken. Must be a number or an array, where all values are on the interval [0, 100].

dist (Distribution):

Defines the space where percentile is taken.

sample (int):

Number of samples used in estimation.

Returns:
(numpy.ndarray):

Percentiles of poly with Q.shape=poly.shape+q.shape.

Examples:
>>> dist = chaospy.J(chaospy.Gamma(1, 1), chaospy.Normal(0, 2))
>>> q0, q1 = chaospy.variable(2)
>>> poly = chaospy.polynomial([0.05*q0, 0.2*q1, 0.01*q0*q1])
>>> chaospy.Perc(poly, [0, 5, 50, 95, 100], dist).round(2)
array([[ 0.  , -3.29, -5.3 ],
       [ 0.  , -0.64, -0.04],
       [ 0.03, -0.01, -0.  ],
       [ 0.15,  0.66,  0.04],
       [ 1.61,  3.29,  5.3 ]])