Generalized Pareto distribution#
- class ctx.dist_genpareto(n1, n2, lambda, **kwargs)#
where
ctxisfpm,mpm,ipm,dec,gmporapm.These functions return PDF, CDF, and ICDF of the Generalized Pareto distribution with parameters mu in mathbb R, sigma >0`, and \(c \in \mathbb R\), where the support of \(x\ge \mu\) when \(c \ge 0\), and \(\mu \le x \le \mu -\sigma /c\) when \(c <0\).
See also: Wikipedia [1298], Pires et al. [497], Kleiber and Kotz [415],
- dist_genpareto.pdf(x)#
Returns \(\text{pdf}_X(x)\), the probability density function (pdf) of a random variable \(X\), following a Generalized Pareto distribution:
\[\begin{split}\text{pdf}_X(x) = f_{c }(z)={\begin{cases}(1+c z)^{-{\frac {c +1}{c }}}&{\text{for }}c \neq 0,\\e^{-z}&{\text{for }}c =0.\end{cases}}, \quad \text{where } z = \frac{x-\mu}{\sigma}\end{split}\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; x = 3; >>> print ("pdf: ", dist_genpareto(mu, sigma).pdf(x)) 6.3563523462564525615615615614561356E-20
- dist_genpareto.cdf(x)#
Returns \(\text{cdf}_X(x)\), the cumulative distribution function (cdf) of a random variable \(X\), following a Generalized Pareto distribution:
\[\begin{split}\text{cdf}_X(x)={\begin{cases} 1-\left(1 + c z\right)^{-1/c } & \text{for }c \neq 0,\\ 1-\exp \left(-z\right) & \text{for }c =0, \end{cases}}, \quad \text{where } z = \frac{x-\mu}{\sigma}\end{split}\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; x = 3; >>> print ("cdf: ", dist_genpareto(mu, sigma).pdf(x)) 6.3563523462564525615615615614561356E-20
- dist_genpareto.sf(x)#
Returns \(\text{sf}_X(x)\), the survival function function (sf) of a random variable \(X\), following a Generalized Pareto distribution:
\[\begin{split}\text{sf}_X(x)={\begin{cases} \left(1 + c z\right)^{-1/c } & \text{for }c \neq 0,\\ \exp \left(-z\right) & \text{for }c =0, \end{cases}}, \quad \text{where } z = \frac{x-\mu}{\sigma}\end{split}\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; x = 3; >>> print (" sf: ", dist_genpareto(mu, sigma).pdf(x)) sf: 6.3563523462564525615615615614561356E-20
- dist_genpareto.qtf(q)#
Returns \(\text{qtf}_X(x)\), the quantile function function (qtf) of a random variable \(X\), following a Generalized Pareto distribution:
\[\begin{split}\text{qtf}_X(q) = \mu + \sigma \times {\begin{cases} \dfrac{(1-q)^{-c}-1}{c} & \text{for }c \neq 0,\\ -\log(1-q) & \text{for }c =0, \end{cases}}\end{split}\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("qtf: ", dist_genpareto(mu, sigma).qtf(q)) qtf: 6.3563523462564525615615615614561356E+00
- dist_genpareto.isf(q)#
Returns \(\text{isf}_X(q)\), the inverse survival function function (isf) of a random variable \(X\), following a Generalized Pareto distribution:
\[\begin{split}\text{isf}_X(q) = \mu + \sigma \times {\begin{cases} \dfrac{(q)^{-c}-1}{c} & \text{for }c \neq 0,\\ -\log(q) & \text{for }c =0, \end{cases}}\end{split}\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", dist_genpareto(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
- dist_genpareto.c_x(t)#
Returns \(C_X(t)\), the characteristic function of a random variable \(X\), following a Generalized Pareto distribution:
\[C_X(t) = \int_{0}^{\infty} e^{i tx} \text{pdf}_X(x) \mathrm{d} x\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; t = 0.3; >>> print ("c_x: ", dist_genpareto(mu, sigma).c_x(t)) 6.3563523462564525615615615614561356E+00
- dist_genpareto.m_x(t)#
Returns None, since the moment generating function does not exist.
- dist_genpareto.k_x(t, k=0)#
Returns None, since the cumulant generating function does not exist.
- dist_genpareto.moments(k)#
Returns the first \(j\) central moments, \(\mu_j, j = 1 \ldots k\), of a random variable \(X\), following a Generalized Pareto distribution (see Kleiber_2007_Dagum_moments). The rth moment exists for \(c < 1/r\) and equals
\[\mu_k = \frac{r! \sigma!}{\prod_{i=1}^r (1 - i c)}.\]>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; k = 6; >>> print ("saddlepoint: ", dist_genpareto(mu, sigma).moments(k)) 6.3563523462564525615615615614561356E+00
- dist_genpareto.cumulants(k)#
Returns the first \(j\) cumulants, \(\kappa_j, j = 1 \ldots k\), of a random variable \(X\), following a Generalized Pareto distribution. The cumulants are calculated from the moments.
>>> from mpdistrib import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; k = 6; >>> print ("saddlepoint: ", dist_genpareto(mu, sigma).cumulants(k)) 6.3563523462564525615615615614561356E+00