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 | Safe-Inferred
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 Source #

The Weibull distribution.

#### Instances

Instances details

FromJSON WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods parseJSON :: Value -> Parser WeibullDistribution Source # parseJSONList :: Value -> Parser [WeibullDistribution] Source #
ToJSON WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods toJSON :: WeibullDistribution -> Value Source # toEncoding :: WeibullDistribution -> Encoding Source # toJSONList :: [WeibullDistribution] -> Value Source # toEncodingList :: [WeibullDistribution] -> Encoding Source #
Data WeibullDistribution Source # |

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

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WeibullDistribution Source #

toConstr :: WeibullDistribution -> Constr Source #

dataTypeOf :: WeibullDistribution -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WeibullDistribution) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WeibullDistribution) Source #

gmapT :: (forall b. Data b => b -> b) -> WeibullDistribution -> WeibullDistribution Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WeibullDistribution -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WeibullDistribution -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> WeibullDistribution -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WeibullDistribution -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WeibullDistribution -> m WeibullDistribution Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WeibullDistribution -> m WeibullDistribution Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WeibullDistribution -> m WeibullDistribution Source #

Generic WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Associated Types type Rep WeibullDistribution :: Type -> Type Source # Methods from :: WeibullDistribution -> Rep WeibullDistribution x Source # to :: Rep WeibullDistribution x -> WeibullDistribution Source #
Read WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods readsPrec :: Int -> ReadS WeibullDistribution Source # readList :: ReadS [WeibullDistribution] Source # readPrec :: ReadPrec WeibullDistribution Source # readListPrec :: ReadPrec [WeibullDistribution] Source #
Show WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods showsPrec :: Int -> WeibullDistribution -> ShowS Source # show :: WeibullDistribution -> String Source # showList :: [WeibullDistribution] -> ShowS Source #
Binary WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods put :: WeibullDistribution -> Put Source # get :: Get WeibullDistribution Source # putList :: [WeibullDistribution] -> Put Source #
Eq WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods (==) :: WeibullDistribution -> WeibullDistribution -> Bool Source # (/=) :: WeibullDistribution -> WeibullDistribution -> Bool Source #
ContDistr WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods density :: WeibullDistribution -> Double -> Double Source # logDensity :: WeibullDistribution -> Double -> Double Source # quantile :: WeibullDistribution -> Double -> Double Source # complQuantile :: WeibullDistribution -> Double -> Double Source #
ContGen WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods genContVar :: StatefulGen g m => WeibullDistribution -> g -> m Double Source #
Distribution WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods cumulative :: WeibullDistribution -> Double -> Double Source # complCumulative :: WeibullDistribution -> Double -> Double Source #
Entropy WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods entropy :: WeibullDistribution -> Double Source #
MaybeEntropy WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods maybeEntropy :: WeibullDistribution -> Maybe Double Source #
MaybeMean WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods maybeMean :: WeibullDistribution -> Maybe Double Source #
MaybeVariance WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods maybeVariance :: WeibullDistribution -> Maybe Double Source # maybeStdDev :: WeibullDistribution -> Maybe Double Source #
Mean WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods mean :: WeibullDistribution -> Double Source #
Variance WeibullDistribution Source # |
Instance details Defined in Statistics.Distribution.Weibull Methods variance :: WeibullDistribution -> Double Source # stdDev :: WeibullDistribution -> Double Source #

FromSample WeibullDistribution Double Source #

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 Source #
type Rep WeibullDistribution Source # |

Instance details

Defined in Statistics.Distribution.Weibull

type Rep WeibullDistribution = D1 ('MetaData "WeibullDistribution" "Statistics.Distribution.Weibull" "statistics-0.16.2.1-EfbCvDihUgt16PhDul7t8F" '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 Source #

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

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

Standard Weibull distribution with scale factor (lambda) 1.

weibullDistrApproxMeanStddevErr Source #

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.