Copyright | (c) 2020 Ximin Luo |
---|---|
License | BSD3 |
Maintainer | infinity0@pwned.gg |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The Weibull distribution. This is a continuous probability distribution that describes the occurrence of a single event whose probability changes over time, controlled by the shape parameter.
Synopsis
Documentation
data WeibullDistribution Source #
The Weibull distribution.
Instances
Constructors
:: Double | Shape |
-> Double | Lambda (scale) |
-> WeibullDistribution |
Create Weibull distribution from parameters.
If the shape (first) parameter is 1.0
, the distribution is equivalent to a
ExponentialDistribution
with parameter
1 / lambda
the scale (second) parameter.
:: Double | Shape |
-> Double | Lambda (scale) |
-> Either String WeibullDistribution |
Create Weibull distribution from parameters.
If the shape (first) parameter is 1.0
, the distribution is equivalent to a
ExponentialDistribution
with parameter
1 / lambda
the scale (second) parameter.
weibullStandard :: Double -> WeibullDistribution Source #
Standard Weibull distribution with scale factor (lambda) 1.
weibullDistrApproxMeanStddevErr Source #
:: Double | Mean |
-> Double | Stddev |
-> Either String WeibullDistribution |
Create Weibull distribution from mean and standard deviation.
The algorithm is from "Methods for Estimating Wind Speed Frequency Distributions", C. G. Justus, W. R. Hargreaves, A. Mikhail, D. Graber, 1977. Given the identity:
\[ (\frac{\sigma}{\mu})^2 = \frac{\Gamma(1+2/k)}{\Gamma(1+1/k)^2} - 1 \]
\(k\) can be approximated by
\[ k \approx (\frac{\sigma}{\mu})^{-1.086} \]
\(\lambda\) is then calculated straightforwardly via the identity
\[ \lambda = \frac{\mu}{\Gamma(1+1/k)} \]
Numerically speaking, the approximation for \(k\) is accurate only within a certain range. We arbitrarily pick the range \(0.033 \le \frac{\sigma}{\mu} \le 1.45\) where it is good to ~6%, and will refuse to create a distribution outside of this range. The paper does not cover these details but it is straightforward to check them numerically.