2.2.5.12. Weibull law

This law describes a weibull distribution depending on the location \(x_{\rm min}\), the scale \(\lambda\) and the shape \(k\), as

\[f(x) = \frac{k}{\lambda} \times\left(\frac{x-x_{\rm min}}{\lambda}\right)^{k-1} \times e^{-\left(\frac{x-x_{\rm min}}{\lambda}\right)^{k}} \; {\rm1\kern-0.28emI}_{[x_{\rm min},+\infty[}(x)\]

Both \(\lambda\) and \(k\) should be greater than 0.0001.

Uranie code to simulate a Weibull random variable is:

tds = DataServer.TDataServer("tdssampler", "Sampler Uranie demo")
tds.addAttribute(DataServer.TWeibullDistribution("wei", 0.5, 2.0, -0.01) )

fsamp = Sampler.TSampling(tds, "lhs", 300)
fsamp.generateSample()  # Create a representative sample

tds.Draw("wei")

Figure 2.21 shows the PDF, CDF and inverse CDF generated for different sets of parameters.

../../../_images/TWeibullDistribution.png

Figure 2.21 Example of PDF, CDF and inverse CDF for Weibull distributions.

Is it also possible to set boundaries to the infinite span of this distribution to create a truncated Weibull law. This can be done by calling the following method:

tds.getAttribute("wei").setBounds(0.2,1.8)  # truncate the law

The resulting PDF, CDF and inverse CDF, with and without truncation, can be seen, in this case, in Figure 2.22 for a given set of parameters and various boundaries.

../../../_images/TWeibullTruncatedDistribution.png

Figure 2.22 Example of PDF, CDF and inverse CDF for a Weibull truncated distribution.