Package dev.nm.stat.evt.evd.univariate
Class GeneralizedParetoDistribution
- java.lang.Object
-
- dev.nm.stat.evt.evd.univariate.GeneralizedParetoDistribution
-
- All Implemented Interfaces:
ProbabilityDistribution
,UnivariateEVD
public class GeneralizedParetoDistribution extends Object implements UnivariateEVD
Generalized Pareto distribution (GPD) is used for modeling exceedances over (or shortfalls below) a threshold. The cumulative distribution function is \[ F(x; \mu,\sigma,\xi) = \begin{cases} 1 - \left(1+ \frac{\xi(x-\mu)}{\sigma}\right)^{-1/\xi} & \text{for} \; \xi \neq 0, \\ 1 - \exp \left(-\frac{x-\mu}{\sigma}\right) & \text{for} \; \xi = 0. \end{cases} \] for \(x \ge \mu\) when \(\xi \ge 0\), and \(\mu \le x \le \mu - \sigma /\xi\) when \(\xi <0\), where \(\mu\in\mathbb R\) is the location parameter, \(\sigma>0\) the scale parameter and \(\xi\in\mathbb R\) the shape parameter. Note that some references give the "shape parameter" as \(\kappa=-\xi\).
-
-
Constructor Summary
Constructors Constructor Description GeneralizedParetoDistribution()
Create an instance with the default parameter values: location \(\mu=0\), scale \(\sigma=1\), shape \(\xi=0\).GeneralizedParetoDistribution(double scale, double shape)
Create an instance with zero location, and the given scale and shape parameters.GeneralizedParetoDistribution(double location, double scale, double shape)
Create an instance with the given parameter values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
cdf(double x)
Gets the cumulative probability F(x) = Pr(X ≤ x).double
density(double x)
The probability density function \[ f(x; \mu,\sigma,\xi) = \begin{cases} \frac{1}{\sigma}\left(1+ \frac{\xi (x-\mu)}{\sigma}\right)^{\left(-\frac{1}{\xi} - 1\right)} & \text{for} \; \xi \neq 0, \\ \frac{1}{\sigma}\exp \left(-\frac{x-\mu}{\sigma}\right) & \text{for} \; \xi = 0 \end{cases} \] for \(x \ge \mu\) when \(\xi \ge 0\), and \(\mu \le x \le \mu - \sigma /\xi\) when \(\xi <0\).double
entropy()
Gets the entropy of this distribution.double
kurtosis()
Gets the excess kurtosis of this distribution.double
logDensity(double x)
Get the logarithm of the probability density function at \(x\), that is, \(\log(f(x))\).double
mean()
\[ \mu + \frac{\sigma}{1-\xi} \] for \(\xi < 1\).double
median()
\[ \mu + \frac{\sigma( 2^{\xi} -1)}{\xi} \]double
moment(double x)
The moment generating function is the expected value of etX.double
quantile(double p)
Gets the quantile, the inverse of the cumulative distribution function.double
skew()
Gets the skewness of this distribution.double
variance()
\[ \frac{\sigma^2}{(1-\xi)^2(1-2\xi)} \] for \(\xi < 1/2\).
-
-
-
Constructor Detail
-
GeneralizedParetoDistribution
public GeneralizedParetoDistribution()
Create an instance with the default parameter values: location \(\mu=0\), scale \(\sigma=1\), shape \(\xi=0\).
-
GeneralizedParetoDistribution
public GeneralizedParetoDistribution(double scale, double shape)
Create an instance with zero location, and the given scale and shape parameters. If GPD is used to model exceedances over a threshold, location is usually set to zero (i.e., location is at the threshold).- Parameters:
scale
- the scale parameter \(\sigma\)shape
- the shape parameter \(\xi\)
-
GeneralizedParetoDistribution
public GeneralizedParetoDistribution(double location, double scale, double shape)
Create an instance with the given parameter values.- Parameters:
location
- the location parameter \(\mu\)scale
- the scale parameter \(\sigma\)shape
- the shape parameter \(\xi\)
-
-
Method Detail
-
density
public double density(double x)
The probability density function \[ f(x; \mu,\sigma,\xi) = \begin{cases} \frac{1}{\sigma}\left(1+ \frac{\xi (x-\mu)}{\sigma}\right)^{\left(-\frac{1}{\xi} - 1\right)} & \text{for} \; \xi \neq 0, \\ \frac{1}{\sigma}\exp \left(-\frac{x-\mu}{\sigma}\right) & \text{for} \; \xi = 0 \end{cases} \] for \(x \ge \mu\) when \(\xi \ge 0\), and \(\mu \le x \le \mu - \sigma /\xi\) when \(\xi <0\).- Specified by:
density
in interfaceProbabilityDistribution
- Parameters:
x
- \(x\)- Returns:
- \(f(x)\)
- See Also:
-
logDensity
public double logDensity(double x)
Description copied from interface:UnivariateEVD
Get the logarithm of the probability density function at \(x\), that is, \(\log(f(x))\).- Specified by:
logDensity
in interfaceUnivariateEVD
- Parameters:
x
- \(x\)- Returns:
- \(\log(f(x))\)
-
cdf
public double cdf(double x)
Description copied from interface:ProbabilityDistribution
Gets the cumulative probability F(x) = Pr(X ≤ x).- Specified by:
cdf
in interfaceProbabilityDistribution
- Parameters:
x
- x- Returns:
- F(x) = Pr(X ≤ x)
- See Also:
- Wikipedia: Cumulative distribution function
-
quantile
public double quantile(double p)
Description copied from interface:ProbabilityDistribution
Gets the quantile, the inverse of the cumulative distribution function. It is the value below which random draws from the distribution would fall u×100 percent of the time.
This may not always exist.F-1(u) = x, such that Pr(X ≤ x) = u
- Specified by:
quantile
in interfaceProbabilityDistribution
- Parameters:
p
-u
, a quantile- Returns:
- F-1(u)
- See Also:
- Wikipedia: Quantile function
-
mean
public double mean()
\[ \mu + \frac{\sigma}{1-\xi} \] for \(\xi < 1\).- Specified by:
mean
in interfaceProbabilityDistribution
- Returns:
- the mean
- See Also:
- Wikipedia: Expected value
-
moment
public double moment(double x)
Description copied from interface:ProbabilityDistribution
The moment generating function is the expected value of etX. That is,E(etX)
This may not always exist.- Specified by:
moment
in interfaceProbabilityDistribution
- Parameters:
x
- t- Returns:
- E(exp(tX))
- See Also:
- Wikipedia: Moment-generating function
-
skew
public double skew()
Description copied from interface:ProbabilityDistribution
Gets the skewness of this distribution.- Specified by:
skew
in interfaceProbabilityDistribution
- Returns:
- the skewness
- See Also:
- Wikipedia: Skewness
-
variance
public double variance()
\[ \frac{\sigma^2}{(1-\xi)^2(1-2\xi)} \] for \(\xi < 1/2\).- Specified by:
variance
in interfaceProbabilityDistribution
- Returns:
- the variance
- See Also:
- Wikipedia: Variance
-
median
public double median()
\[ \mu + \frac{\sigma( 2^{\xi} -1)}{\xi} \]- Specified by:
median
in interfaceProbabilityDistribution
- Returns:
- the median
- See Also:
- Wikipedia: Median
-
kurtosis
public double kurtosis()
Description copied from interface:ProbabilityDistribution
Gets the excess kurtosis of this distribution.- Specified by:
kurtosis
in interfaceProbabilityDistribution
- Returns:
- the excess kurtosis
- See Also:
- Wikipedia: Kurtosis
-
entropy
public double entropy()
Description copied from interface:ProbabilityDistribution
Gets the entropy of this distribution.- Specified by:
entropy
in interfaceProbabilityDistribution
- Returns:
- the entropy
- See Also:
- Wikipedia: Entropy (information theory)
-
-