...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
#include <boost/math/distributions/pareto.hpp>
namespace boost{ namespace math{ template <class RealType = double, class Policy = policies::policy<> > class pareto_distribution; typedef pareto_distribution<> pareto; template <class RealType, class Policy> class pareto_distribution { public: typedef RealType value_type; // Constructor: BOOST_MATH_GPU_ENABLED pareto_distribution(RealType scale = 1, RealType shape = 1) // Accessors: BOOST_MATH_GPU_ENABLED RealType scale()const; BOOST_MATH_GPU_ENABLED RealType shape()const; }; }} // namespaces
The Pareto distribution is a continuous distribution with the probability density function (pdf):
f(x; α, β) = αβα / xα+ 1
For shape parameter α > 0, and scale parameter β > 0. If x < β, the pdf is zero.
The Pareto distribution often describes the larger compared to the smaller. A classic example is that 80% of the wealth is owned by 20% of the population.
The following graph illustrates how the PDF varies with the scale parameter β:
And this graph illustrates how the PDF varies with the shape parameter α:
BOOST_MATH_GPU_ENABLED pareto_distribution(RealType scale = 1, RealType shape = 1);
Constructs a pareto distribution with shape shape and scale scale.
Requires that the shape and scale parameters are both greater than zero, otherwise calls domain_error.
BOOST_MATH_GPU_ENABLED RealType scale()const;
Returns the scale parameter of this distribution.
BOOST_MATH_GPU_ENABLED RealType shape()const;
Returns the shape parameter of this distribution.
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 supported domain of the random variable is [scale, ∞].
In this distribution the implementation of logcdf
is specialized to improve numerical accuracy.
The Pareto distribution is implemented in terms of the standard library
exp
functions plus expm1 and so should have very
small errors, usually only a few epsilon.
If probability is near to unity (or the complement of a probability near zero) see also why complements?.
In the following table α is the shape parameter of the distribution, and β is its scale parameter, x is the random variate, p is the probability and its complement q = 1-p.
Function |
Implementation Notes |
---|---|
|
Using the relation: pdf p = αβα/xα +1 |
cdf |
Using the relation: cdf p = 1 - (β / x)α |
logcdf |
log(cdf) = log1p(-pow(β/x, α)) |
cdf complement |
Using the relation: q = 1 - p = -(β / x)α |
quantile |
Using the relation: x = β / (1 - p)1/α |
quantile from the complement |
Using the relation: x = β / (q)1/α |
mean |
αβ / (β - 1) |
variance |
βα2 / (β - 1)2 (β - 2) |
mode |
α |
skewness |
Refer to Weisstein, Eric W. "Pareto Distribution." From MathWorld--A Wolfram Web Resource. |
kurtosis |
Refer to Weisstein, Eric W. "Pareto Distribution." From MathWorld--A Wolfram Web Resource. |
kurtosis excess |
Refer to Weisstein, Eric W. "pareto Distribution." From MathWorld--A Wolfram Web Resource. |