| Home | Libraries | People | FAQ | More

#### Extreme Value Distribution

    #include <boost/math/distributions/extreme.hpp>

    template <class RealType = double,
              class Policy   = policies::policy<> >
    class extreme_value_distribution;

    typedef extreme_value_distribution<> extreme_value;

    template <class RealType, class Policy>
    class extreme_value_distribution
    {
    public:
       typedef RealType value_type;

       BOOST_MATH_GPU_ENABLED extreme_value_distribution(RealType location = 0, RealType scale = 1);

       BOOST_MATH_GPU_ENABLED RealType scale()const;
       BOOST_MATH_GPU_ENABLED RealType location()const;
    };

There are various extreme value distributions : this implementation represents the maximum case, and is variously known as a Fisher-Tippett distribution, a log-Weibull distribution or a Gumbel distribution.

Extreme value theory is important for assessing risk for highly unusual events, such as 100-year floods.

More information can be found on the NIST, Wikipedia, Mathworld, and Extreme value theory websites.

The relationship of the types of extreme value distributions, of which this is but one, is discussed by Extreme Value Distributions, Theory and Applications Samuel Kotz & Saralees Nadarajah.

The distribution has a PDF given by:

> f(x) = (1/scale) e-(x-location)/scale e-e-(x-location)/scale

which in the standard case (scale = 1, location = 0) reduces to:

> f(x) = e-xe-e-x

The following graph illustrates how the PDF varies with the location parameter:

And this graph illustrates how the PDF varies with the shape parameter:

##### Member Functions

    BOOST_MATH_GPU_ENABLED extreme_value_distribution(RealType location = 0, RealType scale = 1);

Constructs an Extreme Value distribution with the specified location and scale parameters.

Requires `scale > 0`, otherwise calls domain_error.

    BOOST_MATH_GPU_ENABLED RealType location()const;

Returns the location parameter of the distribution.

    BOOST_MATH_GPU_ENABLED RealType scale()const;

Returns the scale parameter of the distribution.

##### Non-member Accessors

All the usual non-member accessor functions that are generic to all distributions are supported: Cumulative Distribution Function, Probability Density Function, Quantile, Hazard Function, Cumulative Hazard Function, __logcdf, __logpdf, mean, median, mode, variance, standard deviation, skewness, kurtosis, kurtosis_excess, range and support. For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can be run on both host and device.

The domain of the random parameter is [-∞, +∞].

In this distribution the implementation of both `logcdf`, and `logpdf` are specialized to improve numerical accuracy.

##### Accuracy

The extreme value distribution is implemented in terms of the standard library `exp` and `log` functions and as such should have very low error rates.

##### Implementation

In the following table: a is the location parameter, b is the scale parameter, x is the random variate, p is the probability and q = 1-p.

Function | Implementation Notes
--- | ---
pdf | Using the relation: pdf = exp((a-x)/b) * exp(-exp((a-x)/b)) / b
logpdf | log(pdf) = log(1/b) + e - exp(e)
cdf | Using the relation: p = exp(-exp((a-x)/b))
logcdf | log(cdf) = -exp((a-x)/b)
cdf complement | Using the relation: q = -expm1(-exp((a-x)/b))
quantile | Using the relation: a - log(-log(p)) * b
quantile from the complement | Using the relation: a - log(-log1p(-q)) * b
mean | a + Euler-Mascheroni-constant * b
standard deviation | pi * b / sqrt(6)
mode | The same as the location parameter a.
skewness | 12 * sqrt(6) * zeta(3) / pi3
kurtosis | 27 / 5
kurtosis excess | kurtosis - 3 or 12 / 5