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 doublecdf(double x)Gets the cumulative probability F(x) = Pr(X ≤ x).doubledensity(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\).doubleentropy()Gets the entropy of this distribution.doublekurtosis()Gets the excess kurtosis of this distribution.doublelogDensity(double x)Get the logarithm of the probability density function at \(x\), that is, \(\log(f(x))\).doublemean()\[ \mu + \frac{\sigma}{1-\xi} \] for \(\xi < 1\).doublemedian()\[ \mu + \frac{\sigma( 2^{\xi} -1)}{\xi} \]doublemoment(double x)The moment generating function is the expected value of etX.doublequantile(double p)Gets the quantile, the inverse of the cumulative distribution function.doubleskew()Gets the skewness of this distribution.doublevariance()\[ \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:
densityin interfaceProbabilityDistribution- Parameters:
x- \(x\)- Returns:
- \(f(x)\)
- See Also:
-
logDensity
public double logDensity(double x)
Description copied from interface:UnivariateEVDGet the logarithm of the probability density function at \(x\), that is, \(\log(f(x))\).- Specified by:
logDensityin interfaceUnivariateEVD- Parameters:
x- \(x\)- Returns:
- \(\log(f(x))\)
-
cdf
public double cdf(double x)
Description copied from interface:ProbabilityDistributionGets the cumulative probability F(x) = Pr(X ≤ x).- Specified by:
cdfin 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:ProbabilityDistributionGets 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:
quantilein 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:
meanin interfaceProbabilityDistribution- Returns:
- the mean
- See Also:
- Wikipedia: Expected value
-
moment
public double moment(double x)
Description copied from interface:ProbabilityDistributionThe moment generating function is the expected value of etX. That is,E(etX)
This may not always exist.- Specified by:
momentin interfaceProbabilityDistribution- Parameters:
x- t- Returns:
- E(exp(tX))
- See Also:
- Wikipedia: Moment-generating function
-
skew
public double skew()
Description copied from interface:ProbabilityDistributionGets the skewness of this distribution.- Specified by:
skewin 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:
variancein interfaceProbabilityDistribution- Returns:
- the variance
- See Also:
- Wikipedia: Variance
-
median
public double median()
\[ \mu + \frac{\sigma( 2^{\xi} -1)}{\xi} \]- Specified by:
medianin interfaceProbabilityDistribution- Returns:
- the median
- See Also:
- Wikipedia: Median
-
kurtosis
public double kurtosis()
Description copied from interface:ProbabilityDistributionGets the excess kurtosis of this distribution.- Specified by:
kurtosisin interfaceProbabilityDistribution- Returns:
- the excess kurtosis
- See Also:
- Wikipedia: Kurtosis
-
entropy
public double entropy()
Description copied from interface:ProbabilityDistributionGets the entropy of this distribution.- Specified by:
entropyin interfaceProbabilityDistribution- Returns:
- the entropy
- See Also:
- Wikipedia: Entropy (information theory)
-
-