statistics-0.16.2.1: A library of statistical types, data, and functions

Copyright | (c) 2020 Ximin Luo
License | BSD3
Maintainer | infinity0@pwned.gg
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Statistics.Distribution.Weibull

Contents

- Constructors

Description

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

- data WeibullDistribution
- weibullDistr :: Double -> Double -> WeibullDistribution
- weibullDistrErr :: Double -> Double -> Either String WeibullDistribution
- weibullStandard :: Double -> WeibullDistribution
- weibullDistrApproxMeanStddevErr :: Double -> Double -> Either String WeibullDistribution

# Documentation

data WeibullDistribution #

The Weibull distribution.

#### Instances

Instances details

FromJSON WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods parseJSON :: Value -> Parser WeibullDistribution # parseJSONList :: Value -> Parser [WeibullDistribution] # omittedField :: Maybe WeibullDistribution #
ToJSON WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods toJSON :: WeibullDistribution -> Value # toEncoding :: WeibullDistribution -> Encoding # toJSONList :: [WeibullDistribution] -> Value # toEncodingList :: [WeibullDistribution] -> Encoding # omitField :: WeibullDistribution -> Bool #
Data WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WeibullDistribution -> c WeibullDistribution # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WeibullDistribution # toConstr :: WeibullDistribution -> Constr # dataTypeOf :: WeibullDistribution -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WeibullDistribution) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WeibullDistribution) # gmapT :: (forall b. Data b => b -> b) -> WeibullDistribution -> WeibullDistribution # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WeibullDistribution -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WeibullDistribution -> r # gmapQ :: (forall d. Data d => d -> u) -> WeibullDistribution -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> WeibullDistribution -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> WeibullDistribution -> m WeibullDistribution # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WeibullDistribution -> m WeibullDistribution # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WeibullDistribution -> m WeibullDistribution #
Generic WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Associated Types
type Rep WeibullDistribution |
Instance details Defined in Statistics.Distribution.Weibull type Rep WeibullDistribution = D1 ('MetaData "WeibullDistribution" "Statistics.Distribution.Weibull" "statistics-0.16.2.1-9EJt18csjGeB8Yk5f7eGk5" 'False) (C1 ('MetaCons "WD" 'PrefixI 'True) (S1 ('MetaSel ('Just "wdShape") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "wdLambda") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double)))
Methods from :: WeibullDistribution -> Rep WeibullDistribution x # to :: Rep WeibullDistribution x -> WeibullDistribution #
Read WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods readsPrec :: Int -> ReadS WeibullDistribution # readList :: ReadS [WeibullDistribution] # readPrec :: ReadPrec WeibullDistribution # readListPrec :: ReadPrec [WeibullDistribution] #
Show WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods showsPrec :: Int -> WeibullDistribution -> ShowS # show :: WeibullDistribution -> String # showList :: [WeibullDistribution] -> ShowS #
Binary WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods put :: WeibullDistribution -> Put # get :: Get WeibullDistribution # putList :: [WeibullDistribution] -> Put #
Eq WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods (==) :: WeibullDistribution -> WeibullDistribution -> Bool # (/=) :: WeibullDistribution -> WeibullDistribution -> Bool #
ContDistr WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods density :: WeibullDistribution -> Double -> Double # logDensity :: WeibullDistribution -> Double -> Double # quantile :: WeibullDistribution -> Double -> Double # complQuantile :: WeibullDistribution -> Double -> Double #
ContGen WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods genContVar :: StatefulGen g m => WeibullDistribution -> g -> m Double #
Distribution WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods cumulative :: WeibullDistribution -> Double -> Double # complCumulative :: WeibullDistribution -> Double -> Double #
Entropy WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods entropy :: WeibullDistribution -> Double #
MaybeEntropy WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods maybeEntropy :: WeibullDistribution -> Maybe Double #
MaybeMean WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods maybeMean :: WeibullDistribution -> Maybe Double #
MaybeVariance WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods maybeVariance :: WeibullDistribution -> Maybe Double # maybeStdDev :: WeibullDistribution -> Maybe Double #
Mean WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods mean :: WeibullDistribution -> Double #
Variance WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull Methods variance :: WeibullDistribution -> Double # stdDev :: WeibullDistribution -> Double #
FromSample WeibullDistribution Double # | Uses an approximation based on the mean and standard deviation in `weibullDistrEstMeanStddevErr`, with standard deviation estimated using maximum likelihood method (unbiased estimation). Returns `Nothing` if sample contains less than one element or variance is zero (all elements are equal), or if the estimated mean and standard-deviation lies outside the range for which the approximation is accurate.
Instance details Defined in Statistics.Distribution.Weibull Methods fromSample :: Vector v Double => v Double -> Maybe WeibullDistribution #
type Rep WeibullDistribution # |
Instance details Defined in Statistics.Distribution.Weibull type Rep WeibullDistribution = D1 ('MetaData "WeibullDistribution" "Statistics.Distribution.Weibull" "statistics-0.16.2.1-9EJt18csjGeB8Yk5f7eGk5" 'False) (C1 ('MetaCons "WD" 'PrefixI 'True) (S1 ('MetaSel ('Just "wdShape") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "wdLambda") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Double)))

# Constructors

weibullDistr #

Arguments

:: 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.

weibullDistrErr #

Arguments

:: 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 #

Standard Weibull distribution with scale factor (lambda) 1.

weibullDistrApproxMeanStddevErr #

Arguments

:: 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.