2.2.5. Introducing the TStochasticAttribute classes
The TStochasticAttribute is the parent class to all attributes which values can be generated by a TSampler
(as discussed in The Stochastic methods). All child objects are random
variables, following a specific law, that depends on a small number of parameters.
As from version 4.8 of the Uranie platform it is possible to combine different probability law, as a sum of weighted contributions, in order to create a new law. This approach, which is further discussed and illustrated in Composing law, leads to a new probability density function that would look like
These distributions can be used to model the behaviour of variables, depending on chosen hypothesis, probability density function being used as a reference more oftenly by physicist, whereas statistical experts will generally use the cumulative distribution function [App13].
Table 2.1 gathers the list of implemented statistical laws, along with its class name in Uranie and the list of parameters used to define them. For every possible law, a piece of code is provided to show how to draw a simple PDF, along with a figure that displays the PDF, CDF and inverse CDF[1] for different sets of parameters (the equation of the corresponding PDF is reminded as well on every figure). The inverse CDF is basically the CDF whose x and y-axis are inverted (it is convenient to keep in mind what it looks like, as it will be used to produce design-of-experiments, later-on).
Law |
Class Uranie |
Parameter 1 |
Parameter 2 |
Parameter 3 |
Parameter 4 |
|---|---|---|---|---|---|
Uniform |
Min |
Max |
|||
Log-Uniform |
Min |
Max |
|||
Triangular |
Min |
Max |
Mode |
||
Log-Triangular |
Min |
Max |
Mode |
||
Normal (Gauss) |
Mean (\(\mu\)) |
Sigma (\(\sigma\)) |
|||
Log-Normal |
Mean (\(M\)) |
Error factor (\(E_f\)) |
Min |
||
Trapezium |
Min |
Max |
Low |
Up |
|
UniformByParts |
Min |
Max |
Median |
||
Exponential |
Rate (\(\lambda\)) |
Min |
|||
Cauchy |
Scale (\(\gamma\)) |
Median |
|||
GumbelMax |
Mode (\(\mu\)) |
Scale (\(\beta\)) |
|||
Weibull |
Scale (\(\lambda\)) |
Shape (\(k\)) |
Min |
||
Beta |
alpha (\(\alpha\)) |
beta (\(\beta\)) |
Min |
Max |
|
GenPareto |
Location (\(\mu\)) |
Scale (\(\sigma\)) |
Shape (\(\xi\)) |
||
Gamma |
Shape (\(\alpha\)) |
Scale (\(\beta\)) |
Location (\(\xi\)) |
||
InvGamma |
Shape (\(\alpha\)) |
Scale (\(\beta\)) |
Location (\(\xi\)) |
||
Student |
DoF (\(k\)) |
||||
GeneralizedNormal |
Location (\(\mu\)) |
Scale (\(\alpha\)) |
Shape (\(\beta\)) |
For all these laws, the parameters can be set at the constructor (as shown in the previous example
block) but, if this has not been done it is possible to change their value using the
setParameters method.
To define a random variable, the corresponding constructor must be used. The arguments of these constructors are first, the name of the variable and second, the parameters of the law. For example:
# Uniform law
pxu = DataServer.TUniformDistribution("x1", -1.0 , 1.0) # (1)
# Gaussian Law
pxn = DataServer.TNormalDistribution("x2", -1.0 , 1.0) # (2)
Allocation of a pointer pxu to a random uniform variable x1 in interval [-1.0, 1.0].
Allocation of a pointer pxn to a random normal variable x2 with mean value \(\mu=-1.0\) and standard deviation \(\sigma=1.0\).
These distributions can be used to model the behaviour of inputs, the choice being generally based on the way the PDF looks like. For every distributions implemented in Uranie examples of PDF, CDF and inverse CDF are show from Uniform Law until InvGamma law. Here is a brief description of the probability density functions and their parameters.
- 2.2.5.1. Uniform Law
- 2.2.5.2. Log Uniform Law
- 2.2.5.3. Triangular Law
- 2.2.5.4. LogTriangular Law
- 2.2.5.5. Normal law
- 2.2.5.6. LogNormal law
- 2.2.5.7. Trapezium law
- 2.2.5.8. UniformByParts law
- 2.2.5.9. Exponential law
- 2.2.5.10. Cauchy law
- 2.2.5.11. GumbelMax law
- 2.2.5.12. Weibull law
- 2.2.5.13. Beta law
- 2.2.5.14. GenPareto law
- 2.2.5.15. Gamma law
- 2.2.5.16. InvGamma law
- 2.2.5.17. Student Law
- 2.2.5.18. Generalized normal law
- 2.2.5.19. Composing law