This is a location-scale family distribution.
Parameters ¶ Location : y 0 ∈ R Scale : σ ∈ R + Shape : κ ∈ R \begin{aligned}
\text{Location}: && &&
y_0 &\in \mathbb{R} \\
\text{Scale}: && &&
\sigma &\in \mathbb{R}^+ \\
\text{Shape}: && &&
\kappa &\in \mathbb{R} \\
\end{aligned} Location : Scale : Shape : y 0 σ κ ∈ R ∈ R + ∈ R Interpretation ¶ We can interpret the shape parameters as follows:
κ = 0 \kappa=0 κ = 0 .
This corresponds to a type 1, short tail distribution with exponential decay.
κ > 0 \kappa>0 κ > 0 .
This corresponds to a type 2, heavy tail distribution with a slow power-law decay.
κ < 0 \kappa<0 κ < 0 .
This corresponds to a type 3, thin-tailed, polynomial decay with a finite upper bound.
Probability Density Function ¶ This is denoted as the probability that our rv Y Y Y will be equivalent to some specific value, y y y , conditioned on the fact that our values are greater than some threshold y 0 y_0 y 0 .
p ( Y = y ∣ y ≥ y 0 ) : = f ( y ; θ ) p(Y=y|y\geq y_0) := f(y;\boldsymbol{\theta}) p ( Y = y ∣ y ≥ y 0 ) := f ( y ; θ ) We can define the probability density function as
f ( y ; θ ) = 1 σ [ 1 + κ ( y − μ σ ) ] + − 1 κ − 1 \begin{aligned}
\boldsymbol{f}(y;\boldsymbol{\theta}) =
\frac{1}{\sigma}\left[ 1 + \kappa \left( \frac{y-\mu}{\sigma} \right)\right]^{-\frac{1}{\kappa} - 1}_+
\end{aligned} f ( y ; θ ) = σ 1 [ 1 + κ ( σ y − μ ) ] + − κ 1 − 1 where a + = max ( a , 0 ) a_+=\text{max}(a,0) a + = max ( a , 0 ) .
Cumulative Distribution Function ¶ This is denoted as the probability that our rv Y Y Y will be less than or equal to some specific value y y y conditioned on the fact that our values are greater than some threshold y 0 y_0 y 0 .
p ( Y ≤ y ∣ y ≥ y 0 ) : = F ( y ; θ ) p(Y\leq y|y\geq y_0) := F(y;\boldsymbol{\theta}) p ( Y ≤ y ∣ y ≥ y 0 ) := F ( y ; θ ) We can define the cumulative density function is defined as:
F ( y ; θ ) = { 1 − [ 1 + κ ( y − μ σ ) ] − 1 / κ , κ ≠ 0 1 − exp ( − y − μ σ ) , κ = 0 \boldsymbol{F}(y;\boldsymbol{\theta}) =
\begin{cases}
1 - \left[ 1 + \kappa \left( \frac{y-\mu}{\sigma} \right)\right]^{-1/\kappa}
, && \kappa\neq 0 \\
1 - \exp\left(-\frac{y-\mu}{\sigma}\right), && \kappa=0
\end{cases} F ( y ; θ ) = { 1 − [ 1 + κ ( σ y − μ ) ] − 1/ κ , 1 − exp ( − σ y − μ ) , κ = 0 κ = 0 Survival Function ¶ This is the exceedence probability of Y Y Y above some value y y y .
However , in this case, this probability is conditioned on the probability of a threshold value, y 0 y_0 y 0 .
S ( y ) : = p ( Y > y ∣ Y > y 0 ) = 1 − p ( Y ≤ y ∣ Y > y 0 ) \boldsymbol{S}(y):= p(Y>y|Y>y_0) = 1 - p(Y\leq y|Y>y_0) S ( y ) := p ( Y > y ∣ Y > y 0 ) = 1 − p ( Y ≤ y ∣ Y > y 0 ) We denote as the survival function of the GPD .
This is simply 1 minus the CDF of the GPD given as:
S ( y ; θ ) = 1 − F ( y ; θ ) \boldsymbol{S}(y;\boldsymbol{\theta}) = 1 - \boldsymbol{F}(y;\boldsymbol{\theta}) S ( y ; θ ) = 1 − F ( y ; θ ) We can plug in the CDF function into this equation defined as:
S ( y ; θ ) = { [ 1 + κ ( y − μ σ ) ] − 1 κ , κ ≠ 0 exp ( − y − μ σ ) , κ = 0 \boldsymbol{S}(y;\boldsymbol{\theta}) =
\begin{cases}
\left[ 1 + \kappa \left( \frac{y-\mu}{\sigma} \right)\right]^{-\frac{1}{\kappa}}, && \kappa\neq 0 \\
\exp\left(-\frac{y-\mu}{\sigma}\right), && \kappa=0
\end{cases} S ( y ; θ ) = { [ 1 + κ ( σ y − μ ) ] − κ 1 , exp ( − σ y − μ ) , κ = 0 κ = 0 Quantile Function ¶ This is also known as the Point-Percentile-Function or the inverse CDF .
This function maps an input threshold, y 0 y_0 y 0 , to a value y y y st the probability of Y Y Y being less than or equal to y y y is y p y_p y p .
y p = F ( y ; θ ) y_p = \boldsymbol{F}(y;\boldsymbol{\theta}) y p = F ( y ; θ ) We can take the inverse of this function to see that it is the inverse CDF which we denote as the quantile function.
y p = F − 1 ( y p ; θ ) : = Q ( y p ; θ ) y_p = \boldsymbol{F}^{-1}(y_p;\boldsymbol{\theta}) := \boldsymbol{Q}(y_p;\boldsymbol{\theta}) y p = F − 1 ( y p ; θ ) := Q ( y p ; θ ) where y p ∈ [ 0 , 1 ] y_p\in[0,1] y p ∈ [ 0 , 1 ] is the data within the probability transform domain.
These can be computed in closed form
Q ( y p ) = { y 0 + σ κ [ ( 1 − y p ) − κ − 1 ] , κ ≠ 0 y 0 − σ log ( 1 − y p ) , κ = 0 \boldsymbol{Q}(y_p) =
\begin{cases}
y_0 + \frac{\sigma}{\kappa} \left[ (1 - y_p)^{-\kappa} - 1 \right], &&
\kappa \neq 0 \\
y_0 - \sigma \log (1 - y_p), &&
\kappa = 0
\end{cases} Q ( y p ) = { y 0 + κ σ [ ( 1 − y p ) − κ − 1 ] , y 0 − σ log ( 1 − y p ) , κ = 0 κ = 0 Derivation,
κ ≠ 0 \kappa\neq 0 κ = 0 Here, we will do the derivation for the case of κ ≠ 0 \kappa\neq 0 κ = 0 .
First, we will write out the CDF and assign it the value of y 0 y_0 y 0 .
F ( y ; θ ) : = y 0 = 1 − ( 1 + κ z ) − 1 / κ \boldsymbol{F}(y;\boldsymbol{\theta}):=y_0 = 1 - \left(1 + \kappa z \right)^{-1/\kappa} F ( y ; θ ) := y 0 = 1 − ( 1 + κ z ) − 1/ κ where κ ≠ 0 \kappa\neq 0 κ = 0 and z = ( y − y 0 ) / σ z=(y - y_0)/\sigma z = ( y − y 0 ) / σ . We will rearrange the terms to get
y 0 = 1 − ( 1 + κ z ) − 1 / κ ( 1 + κ z ) − 1 / κ = 1 − y p − 1 κ log ( 1 + κ z ) = log ( 1 − y p ) log ( 1 + κ z ) = − κ log ( 1 − y p ) 1 + κ z = ( 1 − y p ) − κ κ z = ( 1 − y p ) − κ − 1 z = 1 κ [ ( 1 − y p ) − κ − 1 ] \begin{aligned}
y_0 &= 1 - \left(1 + \kappa z \right)^{-1/\kappa} \\
\left(1+\kappa z \right)^{-1/\kappa} &=
1 - y_p \\
-\frac{1}{\kappa}\log(1 + \kappa z) &=
\log (1 - y_p) \\
\log (1 + \kappa z) &=
- \kappa \log (1 - y_p) \\
1 + \kappa z &=
(1 - y_p)^{-\kappa} \\
\kappa z &= (1 - y_p)^{-\kappa} - 1 \\
z &= \frac{1}{\kappa}\left[ (1 - y_p)^{-\kappa}-1\right] \\
\end{aligned} y 0 ( 1 + κ z ) − 1/ κ − κ 1 log ( 1 + κ z ) log ( 1 + κ z ) 1 + κ z κ z z = 1 − ( 1 + κ z ) − 1/ κ = 1 − y p = log ( 1 − y p ) = − κ log ( 1 − y p ) = ( 1 − y p ) − κ = ( 1 − y p ) − κ − 1 = κ 1 [ ( 1 − y p ) − κ − 1 ] Now, we plug in z z z and we get our final expression
y = μ + σ κ [ ( 1 − y p ) − κ − 1 ] y = \mu + \frac{\sigma}{\kappa}
\left[(1 - y_p)^{-\kappa} - 1 \right] y = μ + κ σ [ ( 1 − y p ) − κ − 1 ] Derivation,
κ = 0 \kappa = 0 κ = 0 Here, we will do the derivation for the case of κ = 0 \kappa = 0 κ = 0 .
First, we will write out the CDF and assign it the value of y 0 y_0 y 0 where κ = 0 \kappa = 0 κ = 0 .
F ( y ; θ ) : = y 0 = 1 − exp ( − z ) \boldsymbol{F}(y;\boldsymbol{\theta}):=y_0 = 1 - \exp(-z) F ( y ; θ ) := y 0 = 1 − exp ( − z ) where κ = 0 \kappa = 0 κ = 0 and z = ( y − y 0 ) / σ z=(y - y_0)/\sigma z = ( y − y 0 ) / σ . We will rearrange the terms to get
y 0 = 1 − exp ( − z ) exp ( − z ) = 1 − y p − z = log ( 1 − y p ) z = − log ( 1 − y p ) \begin{aligned}
y_0 &= 1 - \exp(-z) \\
\exp(-z) &=
1 - y_p \\
-z &=
\log (1 - y_p) \\
z &=
- \log (1 - y_p) \\
\end{aligned} y 0 exp ( − z ) − z z = 1 − exp ( − z ) = 1 − y p = log ( 1 − y p ) = − log ( 1 − y p ) Now, we plug in z z z to get our final expression.
F ( y ; θ ) : = y 0 = 1 − σ log ( 1 − y 0 )
\boldsymbol{F}(y;\boldsymbol{\theta}):=y_0 = 1 - \sigma \log ( 1 - y_0) F ( y ; θ ) := y 0 = 1 − σ log ( 1 − y 0 ) Code Snippet
We can do some naive functions for calculating the quantile functions based on the equations (11)
# function for kappa neq 0
def gpd_quantile(yp, loc, scale, shape):
# loc - scale / shape * (1 - (- log(1 - p)) ** (- shape))
return loc + scale / shape * ((1 - yp) ** (- shape) - 1)
# function for kappa = 0
def quantile(yp, loc, scale):
return loc - scale * log(1 - yp)
However, we can take into account some of the numerical errors that can come up.
We can look at the expression in equation (11) to be functions of the shape parameter only.
F z ( y p ; κ ) = { 1 κ [ ( 1 − y p ) − κ − 1 ] , κ ≠ 0 − log ( 1 − y p ) , κ = 0 \boldsymbol{F}_z(y_p;\kappa) =
\begin{cases}
\frac{1}{\kappa} \left[ (1-y_p)^{-\kappa} - 1\right], && \kappa \neq 0 \\
- \log (1 - y_p), && \kappa = 0
\end{cases} F z ( y p ; κ ) = { κ 1 [ ( 1 − y p ) − κ − 1 ] , − log ( 1 − y p ) , κ = 0 κ = 0 We will do some manipulation to write this in terms of a single function
F z ( y p ; κ ) = { 1 κ exp [ − κ log ( 1 − y p ) ] − 1 , κ ≠ 0 − log ( 1 − y p ) , κ = 0 \boldsymbol{F}_z(y_p;\kappa) =
\begin{cases}
\frac{1}{\kappa}\exp\left[-\kappa\log (1 - y_p)\right] - 1, && \kappa \neq 0 \\
- \log (1 - y_p), && \kappa = 0
\end{cases} F z ( y p ; κ ) = { κ 1 exp [ − κ log ( 1 − y p ) ] − 1 , − log ( 1 − y p ) , κ = 0 κ = 0 This makes it easier to code while taking into account numerical errors because we can do a simple where
statement.
# location scale inverse
def location_scale_inverse(z, location, scale):
return location + scale * z
def location_scale_forward(x, location, scale):
return (x - location) / scale
def gpd_quantile_shape(y_p, shape):
# get boolian array
is_shape_zero = jnp.equal(shape, 0.0)
# calculate the true shape
safe_shape = jnp.where(is_shape_zero, 0.0, shape)
# calculate negative log term, -log(1-yp)
shape_zero_term = - jnp.log1p(- y_p)
# calculate k neq 0, exp(-k log(1-yp)) / k
shape_nonzero_term = jnp.expm1(shape * neglog1mp) / safe_shape
# zero
term = jnp.where(is_shape_zero, shape_zero_term, shape_nonzero_term)
return term
# function for kappa > 0
def gpd_quantile(y_p, loc, scale, shape):
# calculate the shape parameter
z = gpd_quantile_shape(y_p, shape)
# calculate the inverse of location-scale
return location_scale_inverse(z, loc, scale)
Inverse Survival Function ¶ The inverse survival function maps the input value y s y_s y s to some probability value y p y_p y p which represents the probability that there is some value greater than said input value.
y s = P r [ Y > y p ] y_s = Pr[Y> y_p] y s = P r [ Y > y p ] So recall the survival function is the negative of the CDF .
This implies that the inverse survival function is the negative of the quantile function.
y p = S ( y ; θ ) = 1 − F ( y ; θ ) y_p = \boldsymbol{S}(y;\boldsymbol{\theta}) = 1 - \boldsymbol{F}(y;\boldsymbol{\theta}) y p = S ( y ; θ ) = 1 − F ( y ; θ ) We can take the inverse of this function to see that it is the inverse CDF which we denote as the quantile function.
y p = S − 1 ( y s ; θ ) : = Q ( y s ; θ ) y_p = \boldsymbol{S}^{-1}(y_s;\boldsymbol{\theta}) := \boldsymbol{Q}(y_s;\boldsymbol{\theta}) y p = S − 1 ( y s ; θ ) := Q ( y s ; θ ) where y s ∈ [ 0 , 1 ] y_s\in[0,1] y s ∈ [ 0 , 1 ] is the survival probability within the probability transform domain.
These can be computed in closed form
Q − 1 ( y s ) = { y 0 + σ κ [ y s − κ − 1 ] , κ ≠ 0 y 0 − σ log y p , κ = 0 \boldsymbol{Q}^{-1}(y_s) =
\begin{cases}
y_0 + \frac{\sigma}{\kappa} \left[ y_s^{-\kappa} - 1 \right], &&
\kappa \neq 0 \\
y_0 - \sigma \log y_p, &&
\kappa = 0
\end{cases} Q − 1 ( y s ) = { y 0 + κ σ [ y s − κ − 1 ] , y 0 − σ log y p , κ = 0 κ = 0 where y s = 1 − y p y_s=1-y_p y s = 1 − y p is the survival probability.
Code Snippet
We can reuse the code snippet from before.
# function for kappa > 0
def gpd_isf(y_s, loc, scale, shape):
# calculate the shape parameter
z = gpd_quantile_shape(1 - y_s, shape)
# calculate the inverse of location-scale
return location_scale_inverse(z, loc, scale)
Joint Distribution ¶ We can write the likelihood that the observations, y y y , follow the GEVD distribution.
So, given some observations, D = { y n } n = 1 N \mathcal{D}=\{y_n\}_{n=1}^{N} D = { y n } n = 1 N , which we believe follow the GEVD distribution, we can write the joint distribution decomposition as
p ( y 1 : N > y 0 , y > y 0 , θ ) = p ( θ ) ∏ n = 1 N p ( y n ∣ y n > y 0 , θ ) p ( y n > y 0 ∣ θ ) p(y_{1:N}>y_0, y>y_0,\boldsymbol{\theta}) =
p(\boldsymbol{\theta})
\prod_{n=1}^N
p(y_n|y_n>y_0,\boldsymbol{\theta})p(y_n>y_0|\boldsymbol{\theta}) p ( y 1 : N > y 0 , y > y 0 , θ ) = p ( θ ) n = 1 ∏ N p ( y n ∣ y n > y 0 , θ ) p ( y n > y 0 ∣ θ ) This implies that the global prior parameters come from some distribution
θ ∼ p ( θ ) \boldsymbol{\theta} \sim p(\boldsymbol{\theta}) θ ∼ p ( θ ) and that these parameters get passed through our data likelihood term
y n ∼ p ( y ∣ θ ) y_n \sim p(y|\boldsymbol{\theta}) y n ∼ p ( y ∣ θ ) Log Probability ¶ Let’s say we are given some samples.
D = { y n } n = 1 N \mathcal{D} = \left\{ y_n\right\}_{n=1}^N D = { y n } n = 1 N where N N N are the number of exceedances above our threshold, y 0 y_0 y 0 .
Recall the GPD PDF for our iid samples is
p ( y 1 : N ∣ θ ) = ∏ n = 1 N 1 σ [ 1 + κ ( y n − y 0 σ ) ] + − 1 κ − 1 p(y_{1:N}|\boldsymbol{\theta}) = \prod_{n=1}^N
\frac{1}{\sigma}\left[ 1 + \kappa \left( \frac{y_n-y_0}{\sigma} \right)\right]^{-\frac{1}{\kappa} - 1}_+ p ( y 1 : N ∣ θ ) = n = 1 ∏ N σ 1 [ 1 + κ ( σ y n − y 0 ) ] + − κ 1 − 1 We can add the log term to get
log p ( y 1 : N ∣ θ ) = ∑ n = 1 N log [ 1 + κ ( y n − y 0 σ ) ] + − 1 κ − 1 \log p(\boldsymbol{y}_{1:N}|\boldsymbol{\theta}) = \sum_{n=1}^N \log
\left[ 1 + \kappa \left( \frac{y_n-y_0}{\sigma} \right)\right]^{-\frac{1}{\kappa} - 1}_+ log p ( y 1 : N ∣ θ ) = n = 1 ∑ N log [ 1 + κ ( σ y n − y 0 ) ] + − κ 1 − 1 which reduces to
log p ( y 1 : N ∣ θ ) = − N log σ − ( 1 + 1 / κ ) ∑ n = 1 N log [ 1 + κ z n ] + \log p(\boldsymbol{y}_{1:N}|\boldsymbol{\theta}) =
- N \log \sigma -
(1+1/\kappa)\sum_{n=1}^N
\log \left[ 1 + \kappa z_n\right]_+ log p ( y 1 : N ∣ θ ) = − N log σ − ( 1 + 1/ κ ) n = 1 ∑ N log [ 1 + κ z n ] + where z n = ( y n − y 0 ) / σ z_n=(y_n - y_0)/\sigma z n = ( y n − y 0 ) / σ and [ 1 + κ z n ] + = max ( 1 + κ z n , 0 ) [1 + \kappa z_n]_+ = \text{max}(1 + \kappa z_n,0) [ 1 + κ z n ] + = max ( 1 + κ z n , 0 ) .
Code Snippet
We can create an likelihood function for this.
def gpd_logpdf(x, location, scale, shape):
# calculate location scale: z=(y−μ)/σ
z = (x - location) / scale
# calculate t(z) = max(1+κz)
t = max(1.0 + shape * z, 0)
# term 1: −log σ
t1 = - np.log(scale)
# term 2: - (1+1/κ)log(1+κz)
t2 = - (1.0 / shape + 1.0) * np.log(t)
return t1 + t2
Instead of actually calculating the full scheme, we can simply apply this
y: Array["T"] = ...
params: PyTree = ...
# apply vectorized operation
nll: Array["T"] = vectorize(gpd_logpdf, y, *params)
# take the sume
nll: Scalar = sum(nll)
Proof of Log-Probability,
κ ≠ 0 \kappa\neq 0 κ = 0 We are interested in calculating the log probability function
log p ( y 1 : N ∣ θ ) = ∑ n = 1 N log p ( y n ∣ θ ) \log p(\boldsymbol{y}_{1:N}|\boldsymbol{\theta}) = \sum_{n=1}^N \log p(y_n|\boldsymbol{\theta}) log p ( y 1 : N ∣ θ ) = n = 1 ∑ N log p ( y n ∣ θ ) Let’s consider only a single input, y n y_n y n .
We plug in t ( y n ; θ ) \boldsymbol{t}(y_n;\boldsymbol{\theta}) t ( y n ; θ ) to the likelihood term.
p ( y n ∣ θ ) = 1 σ [ 1 + κ ( y − y 0 σ ) ] + − 1 κ − 1 p(y_n|\boldsymbol{\theta}) = \frac{1}{\sigma}\left[ 1 + \kappa \left( \frac{y-y_0}{\sigma} \right)\right]^{-\frac{1}{\kappa} - 1}_+ p ( y n ∣ θ ) = σ 1 [ 1 + κ ( σ y − y 0 ) ] + − κ 1 − 1 Now, we apply the log function
log p ( y n ∣ θ ) = log ( 1 σ [ 1 + κ ( y − y 0 σ ) ] + − 1 κ − 1 ) \log p(y_n|\boldsymbol{\theta}) = \log
\left(
\frac{1}{\sigma}
\left[ 1 + \kappa \left( \frac{y-y_0}{\sigma} \right)\right]^{-\frac{1}{\kappa} - 1}_+
\right) log p ( y n ∣ θ ) = log ( σ 1 [ 1 + κ ( σ y − y 0 ) ] + − κ 1 − 1 ) We can separate each of the terms
log p ( y n ∣ θ ) = log ( 1 σ ) + log ( [ 1 + κ ( y − y 0 σ ) ] + − 1 κ − 1 ) \log p(y_n|\boldsymbol{\theta}) = \log
\left(\frac{1}{\sigma}\right) +
\log
\left(
\left[ 1 + \kappa \left( \frac{y-y_0}{\sigma} \right)\right]^{-\frac{1}{\kappa} - 1}_+
\right) log p ( y n ∣ θ ) = log ( σ 1 ) + log ( [ 1 + κ ( σ y − y 0 ) ] + − κ 1 − 1 ) Now we can do some log rules to simplify the terms
log p ( y n ∣ θ ) = − log σ + ( − 1 κ − 1 ) log [ 1 + κ ( y − y 0 σ ) ] + \log p(y_n|\boldsymbol{\theta}) =
-\log \sigma + \left(-\frac{1}{\kappa} - 1\right)\log
\left[ 1 + \kappa \left( \frac{y-y_0}{\sigma} \right)\right]_+ log p ( y n ∣ θ ) = − log σ + ( − κ 1 − 1 ) log [ 1 + κ ( σ y − y 0 ) ] + We can plug in the t ( y ; θ ) \boldsymbol{t}(y;\boldsymbol{\theta}) t ( y ; θ ) to get a complete form.
Let z = y − y 0 σ z=\frac{y-y_0}{\sigma} z = σ y − y 0
log p ( y n ∣ θ ) = − log σ + ( − 1 κ − 1 ) log [ 1 + κ z ] + \log p(y_n|\boldsymbol{\theta}) =
-\log \sigma +
\left(-\frac{1}{\kappa} - 1\right)
\log \left[ 1 + \kappa z\right]_+ log p ( y n ∣ θ ) = − log σ + ( − κ 1 − 1 ) log [ 1 + κ z ] + Now, we can plug in the sum
log p ( y 1 : N ∣ θ ) = ∑ n = 1 N ( − log σ − ( 1 + 1 / κ ) log [ 1 + κ z n ] + ) \log p(\boldsymbol{y}_{1:N}|\boldsymbol{\theta}) =
\sum_{n=1}^N
\left(
-\log \sigma -
(1+1/\kappa)
\log \left[ 1 + \kappa z_n\right]_+
\right) log p ( y 1 : N ∣ θ ) = n = 1 ∑ N ( − log σ − ( 1 + 1/ κ ) log [ 1 + κ z n ] + ) We can factor out the constant values
log p ( y 1 : N ∣ θ ) = − N log σ − ( 1 + 1 / κ ) ∑ n = 1 N log [ 1 + κ z n ] + \log p(\boldsymbol{y}_{1:N}|\boldsymbol{\theta}) =
- N \log \sigma -
(1+1/\kappa)\sum_{n=1}^N
\log \left[ 1 + \kappa z_n\right]_+ log p ( y 1 : N ∣ θ ) = − N log σ − ( 1 + 1/ κ ) n = 1 ∑ N log [ 1 + κ z n ] + Return Period ¶ We can calculate the RP using equation (8) .
R T = P r [ Y > y ∣ Y > y 0 ] P r [ Y > y 0 ] R_T = Pr[Y>y|Y>y_0]Pr[Y>y_0] R T = P r [ Y > y ∣ Y > y 0 ] P r [ Y > y 0 ] We assume that the occurrence of events over the threshold, y 0 y_0 y 0 , is given by the Poisson process.
λ p = P r [ Y > y 0 ] \lambda_p = Pr[Y>y_0] λ p = P r [ Y > y 0 ] We can calculate the RP using equation (8) .
Practically, we set this to the survival function of the GEVD (equation ).
1 / T R = λ p S ( y ; θ ) = λ p ( 1 − F ( y ; θ ) ) 1/T_R =
\lambda_p\boldsymbol{S}(y;\boldsymbol{\theta})=
\lambda_p\left(1-\boldsymbol{F}(y;\boldsymbol{\theta})\right) 1/ T R = λ p S ( y ; θ ) = λ p ( 1 − F ( y ; θ ) ) If we rearrange this equation, we get
y p : = F ( y ; θ ) = 1 − 1 / ( λ p T R ) y_p := \boldsymbol{F}(y;\boldsymbol{\theta}) = 1 - 1 / (\lambda_p T_R) y p := F ( y ; θ ) = 1 − 1/ ( λ p T R ) To make things simpler, we can simply use the quantile function in equation (11) and set the probability to
y p = 1 − 1 / ( λ p T R ) y_p = 1 - 1 / (\lambda_p T_R) y p = 1 − 1/ ( λ p T R ) However, if we expand this out, we get
y = { y 0 + σ κ [ ( λ p T R ) κ − 1 ] , κ ≠ 0 y 0 + σ log ( λ p T R ) , κ = 0 y =
\begin{cases}
y_0 + \frac{\sigma}{\kappa} \left[ (\lambda_p T_R)^{\kappa} - 1 \right], &&
\kappa \neq 0 \\
y_0 + \sigma \log (\lambda_p T_R), &&
\kappa = 0
\end{cases} y = { y 0 + κ σ [ ( λ p T R ) κ − 1 ] , y 0 + σ log ( λ p T R ) , κ = 0 κ = 0 Proof
In general, we can expand the RHS of the equation to include the CDF
1 − 1 / T R = exp ( − t ( y ; θ ) ) 1 - 1/T_R = \exp \left( -t(y;\boldsymbol{\theta}) \right) 1 − 1/ T R = exp ( − t ( y ; θ ) ) and we can reduce this to be:
− log ( 1 − 1 / T R ) = t ( y ; θ ) -\log\left(1-1/T_R\right) = t(y;\boldsymbol{\theta}) − log ( 1 − 1/ T R ) = t ( y ; θ ) Finally, we can plug in the κ ≠ 0 \kappa \neq 0 κ = 0 term to get
− log ( 1 − 1 / T R ) = [ 1 + κ z ] + − 1 / κ log [ − log ( 1 − 1 / T R ) ] = − ( 1 / κ ) log [ 1 + κ z ] log ( 1 + κ z ) = − κ log [ − log ( 1 − 1 / T R ) ] 1 + κ z = [ − log ( 1 − 1 / T R ) ] − κ κ z = [ log ( 1 − 1 / T R ) ] κ − 1 z = 1 κ { [ log ( 1 − 1 / T R ) ] κ − 1 } \begin{aligned}
-\log\left(1-1/T_R\right) &= [1 + \kappa z]_+^{-1/\kappa} \\
\log\left[-\log\left(1-1/T_R\right)\right]&= -(1/\kappa)\log[1 + \kappa z] \\
\log(1+\kappa z) &= -\kappa\log\left[-\log\left(1-1/T_R\right)\right] \\
1+\kappa z &=\left[-\log\left(1-1/T_R\right)\right]^{-\kappa} \\
\kappa z &= \left[\log\left(1-1/T_R\right)\right]^{\kappa}-1\\
z &= \frac{1}{\kappa}\left\{\left[\log\left(1-1/T_R\right)\right]^{\kappa}-1\right\} \\
\end{aligned} − log ( 1 − 1/ T R ) log [ − log ( 1 − 1/ T R ) ] log ( 1 + κ z ) 1 + κ z κ z z = [ 1 + κ z ] + − 1/ κ = − ( 1/ κ ) log [ 1 + κ z ] = − κ log [ − log ( 1 − 1/ T R ) ] = [ − log ( 1 − 1/ T R ) ] − κ = [ log ( 1 − 1/ T R ) ] κ − 1 = κ 1 { [ log ( 1 − 1/ T R ) ] κ − 1 } Now, we can plug in the normalization factor
y = μ + σ κ { [ log ( 1 − 1 / T R ) ] κ − 1 } y = \mu + \frac{\sigma}{\kappa}\left\{\left[\log\left(1-1/T_R\right)\right]^{\kappa}-1\right\} y = μ + κ σ { [ log ( 1 − 1/ T R ) ] κ − 1 } We can do the same thing for κ = 0 \kappa = 0 κ = 0 term to get
− log ( 1 − 1 / T R ) = exp ( − z ) log ( − log ( 1 − 1 / T R ) ) = − z z = − log ( − log ( 1 − 1 / T R ) ) \begin{aligned}
-\log (1 - 1/T_R) &= \exp(-z) \\
\log \left(-\log(1 - 1/T_R)\right) &= - z \\
z &= - \log \left(-\log(1 - 1/T_R)\right) \\
\end{aligned} − log ( 1 − 1/ T R ) log ( − log ( 1 − 1/ T R ) ) z = exp ( − z ) = − z = − log ( − log ( 1 − 1/ T R ) ) Now, we can plug in the normalization factor
y = μ − σ log [ − log ( 1 − 1 / T R ) ] y = \mu - \sigma \log \left[ - \log \left(1 - 1/T_R \right) \right] y = μ − σ log [ − log ( 1 − 1/ T R ) ] Average Recurrence Interval ¶ We can calculate the RP using equation (14) .
exp ( − 1 / T ˉ ) = exp ( − P r [ Y > y ∣ Y > y 0 ] P r [ Y > y 0 ] ) \exp(-1/\bar{T}) =
\exp\left(
-Pr[Y>y|Y>y_0]Pr[Y>y_0]
\right) exp ( − 1/ T ˉ ) = exp ( − P r [ Y > y ∣ Y > y 0 ] P r [ Y > y 0 ] ) Removing the exponential components, we are left with
1 / T ˉ = P r [ Y > y ∣ Y > y 0 ] P r [ Y > y 0 ] 1/\bar{T} =
Pr[Y>y|Y>y_0]Pr[Y>y_0] 1/ T ˉ = P r [ Y > y ∣ Y > y 0 ] P r [ Y > y 0 ] We assume that the occurrence of events over the threshold, y 0 y_0 y 0 , is given by the Poisson process.
λ p = P r [ Y > y 0 ] \lambda_p = Pr[Y>y_0] λ p = P r [ Y > y 0 ] We can calculate the RP using equation (14) .
Practically, we set this to the survival function of the GEVD (equation ).
1 / T ˉ = λ p S ( y ; θ ) = λ p ( 1 − F ( y ; θ ) ) 1/\bar{T} =
\lambda_p\boldsymbol{S}(y;\boldsymbol{\theta})=
\lambda_p\left(1-\boldsymbol{F}(y;\boldsymbol{\theta})\right) 1/ T ˉ = λ p S ( y ; θ ) = λ p ( 1 − F ( y ; θ ) ) If we rearrange this equation, we get
y p : = F ( y ; θ ) = 1 − 1 / ( λ p T R ) y_p := \boldsymbol{F}(y;\boldsymbol{\theta}) = 1 - 1 / (\lambda_p T_R) y p := F ( y ; θ ) = 1 − 1/ ( λ p T R ) To make things simpler, we can simply use the quantile function in equation (11) and set the probability to
y p = 1 − 1 / ( λ p T ˉ ) y_p = 1 - 1 / (\lambda_p \bar{T}) y p = 1 − 1/ ( λ p T ˉ ) However, if we expand this out, we get
y = { y 0 + σ κ [ ( λ p T ˉ ) κ − 1 ] , κ ≠ 0 y 0 + σ log ( λ p T ˉ ) , κ = 0 y =
\begin{cases}
y_0 + \frac{\sigma}{\kappa} \left[ (\lambda_p \bar{T})^{\kappa} - 1 \right], &&
\kappa \neq 0 \\
y_0 + \sigma \log (\lambda_p \bar{T}), &&
\kappa = 0
\end{cases} y = { y 0 + κ σ [ ( λ p T ˉ ) κ − 1 ] , y 0 + σ log ( λ p T ˉ ) , κ = 0 κ = 0 Proof
In general, we can expand the RHS of the equation to include the CDF
exp ( − 1 / T ˉ ) = exp ( − t ( y ; θ ) ) \exp(-1/\bar{T}) = \exp \left( -t(y;\boldsymbol{\theta}) \right) exp ( − 1/ T ˉ ) = exp ( − t ( y ; θ ) ) and we can reduce this to be:
1 / T ˉ = t ( y ; θ ) 1/\bar{T} = t(y;\boldsymbol{\theta}) 1/ T ˉ = t ( y ; θ ) Finally, we can plug in the κ ≠ 0 \kappa \neq 0 κ = 0 term to get
T ˉ = [ 1 + κ z ] + 1 / κ κ log T ˉ = log [ 1 + κ z ] 1 + κ z = T ˉ κ z = 1 κ ( T ˉ κ − 1 ) \begin{aligned}
\bar{T} &= [1 + \kappa z]_+^{1/\kappa} \\
\kappa \log \bar{T} &= \log [ 1 + \kappa z] \\
1 + \kappa z &= \bar{T}^{\kappa} \\
z &= \frac{1}{\kappa}\left( \bar{T}^{\kappa}-1\right) \\
\end{aligned} T ˉ κ log T ˉ 1 + κ z z = [ 1 + κ z ] + 1/ κ = log [ 1 + κ z ] = T ˉ κ = κ 1 ( T ˉ κ − 1 ) Now, we can plug in the normalization factor
y = μ + σ κ ( T ˉ κ − 1 ) y = \mu + \frac{\sigma}{\kappa}\left( \bar{T}^{\kappa}-1\right) y = μ + κ σ ( T ˉ κ − 1 ) We can do the same thing for κ = 0 \kappa = 0 κ = 0 term to get
1 / T ˉ = exp ( − z ) z = log T ˉ \begin{aligned}
1/\bar{T} &= \exp(-z) \\
z &= \log \bar{T}
\end{aligned} 1/ T ˉ z = exp ( − z ) = log T ˉ Now, we can plug in the normalization factor
y = μ + σ log T ˉ y = \mu + \sigma\log \bar{T} y = μ + σ log T ˉ Reparameterization ¶ In this instance, we are assuming that there is a threshold parameter, y 0 y_0 y 0 .
We can write the reparameterization of the GPD in terms of the GEV distribution
μ y 0 = μ + σ κ ( 1 − λ y 0 κ ) σ y 0 = σ λ y 0 κ κ ≠ 0 μ y 0 = μ − σ ln λ y 0 σ y 0 = σ λ y 0 κ κ = 0 \begin{aligned}
\mu_{y_0} &= \mu + \frac{\sigma}{\kappa}\left(1 - \lambda_{y_0}^{\kappa} \right) && &&
\sigma_{y_0} =\sigma\lambda_{y_0}^{\kappa} && &&
\kappa\neq0 \\
\mu_{y_0} &= \mu - \sigma\ln\lambda_{y_0} && &&
\sigma_{y_0} =\sigma\lambda_{y_0}^{\kappa} && &&
\kappa=0 \\
\end{aligned} μ y 0 μ y 0 = μ + κ σ ( 1 − λ y 0 κ ) = μ − σ ln λ y 0 σ y 0 = σ λ y 0 κ σ y 0 = σ λ y 0 κ κ = 0 κ = 0 We can also re-parameterize the λ y 0 \lambda_{y_0} λ y 0 in terms of the GPD and GEV parameters.
λ y 0 = log [ 1 + κ z ] − 1 κ , z = ( y − μ y 0 ) / σ σ y 0 = σ + κ ( y − μ y 0 ) κ y 0 = κ \begin{aligned}
\lambda_{y_0} &= \log
\left[ 1 + \kappa z \right]^{- \frac{1}{\kappa}}, && &&
z = (y - \mu_{y_0})/\sigma \\
\sigma_{y_0} &=\sigma + \kappa(y - \mu_{y_0}) \\
\kappa_{y_0} &= \kappa
\end{aligned} λ y 0 σ y 0 κ y 0 = log [ 1 + κ z ] − κ 1 , = σ + κ ( y − μ y 0 ) = κ z = ( y − μ y 0 ) / σ Lastly, we can do something similar like so
log λ = − 1 κ ln [ 1 + κ y 0 − μ σ ] σ y 0 = σ + κ ( y 0 − μ ) κ y 0 = κ \begin{aligned}
\log\lambda &= - \frac{1}{\kappa}\ln
\left[ 1 + \kappa \frac{y_0 - \mu}{\sigma} \right] \\
\sigma_{y_0} &=\sigma + \kappa(y_0 - \mu) \\
\kappa_{y_0} &= \kappa
\end{aligned} log λ σ y 0 κ y 0 = − κ 1 ln [ 1 + κ σ y 0 − μ ] = σ + κ ( y 0 − μ ) = κ There has also been a similar reparameterization found in
λ = 1 − exp { − h [ 1 + κ ( y 0 − μ ) / σ ] − 1 / κ } \lambda = 1 - \exp
\left\{ - h \left[ 1 + \kappa(y_0 - \mu)/\sigma\right]^{-1/\kappa}\right\} λ = 1 − exp { − h [ 1 + κ ( y 0 − μ ) / σ ] − 1/ κ } σ y 0 = log [ σ + κ ( y 0 − μ ) / σ ] \sigma_{y_0} = \log[\sigma + \kappa(y_0 - \mu)/\sigma] σ y 0 = log [ σ + κ ( y 0 − μ ) / σ ] Similarly, another reparameterization is
σ y 0 = σ + κ ( y 0 − μ ) \sigma_{y_0} = \sigma + \kappa (y_0 - \mu) σ y 0 = σ + κ ( y 0 − μ ) Background ¶ p ( Y ≤ y + y 0 ∣ Y > y 0 ) = 1 − 1 − F ( y + y 0 ) 1 − F ( y 0 ) p(Y\leq y+y_0|Y>y_0) = 1 - \frac{1-F(y+y_0)}{1-F(y_0)} p ( Y ≤ y + y 0 ∣ Y > y 0 ) = 1 − 1 − F ( y 0 ) 1 − F ( y + y 0 ) where y > 0 y>0 y > 0 .
If we let y 0 → ∞ y_0\rightarrow\infty y 0 → ∞ , then this leads to an approximate family of distributions given by the GPD
Marginal Survival Function ¶ We are interested in the marginal probability of occurrence above an arbitrary maximum value, y y y .
We can write the joint distribution of both quantities to be factored as follows.
p ( Y > y , Y > y 0 ) = p ( Y > y ∣ Y > y 0 ) p ( Y > y 0 ) p(Y>y,Y>y_0)=p(Y>y|Y>y_0)p(Y>y_0) p ( Y > y , Y > y 0 ) = p ( Y > y ∣ Y > y 0 ) p ( Y > y 0 ) The first term is the rate of exceedences above some quantity y y y given some threshold, y 0 y_0 y 0 .
The second term is the probability that an event is above some threshold, y 0 y_0 y 0 .
We could also describe it as the rate of exceedences above some threshold, y 0 y_0 y 0 .
Let’s define an arrival rate λ to be the average number of events per year larger than a threshold, y 0 y_0 y 0 .
This is analogous to a Poisson distribution.
p ( Y > y 0 ) : = Pois ( Y = k ) p(Y>y_0) := \text{Pois}(Y=k) p ( Y > y 0 ) := Pois ( Y = k ) where k k k is the number of occurrences within some period T T T .
We can write down this distribution as
f ( k ; λ ) = λ k k ! e − λ f(k;\lambda)= \frac{\lambda^k}{k!}e^{-\lambda} f ( k ; λ ) = k ! λ k e − λ We know that the expected value is simply the parameter λ.
E [ p ( Y > y 0 ) ] = λ \mathbb{E}\left[p(Y>y_0) \right] = \lambda E [ p ( Y > y 0 ) ] = λ We can calculate this approximately by summing the number of events, over the threshold, y 0 y_0 y 0 , and then we divide them by the total number of events, N y 0 N_{y_0} N y 0
λ ^ = 1 N y 0 ∑ n = 1 N y 0 I ( y n > y 0 ) \hat{\lambda} = \frac{1}{N_{y_0}}\sum_{n=1}^{N_{y_0}} \boldsymbol{I}(y_n > y_0) λ ^ = N y 0 1 n = 1 ∑ N y 0 I ( y n > y 0 ) To relate this back to our function, we would need the rate parameter λ in units as events per year
λ y e a r = λ t [ events ] [ year ] − 1 \lambda_{year} =
\lambda t \hspace{5mm} [\text{events}][\text{year}]^{-1} λ ye a r = λ t [ events ] [ year ] − 1 where t t t is some conversion factor from whatever time unit to years.
Literature Review ¶ There are many cases where the GPD is used within the literature.
We split this section into theory and applications.
However, most of the theoretic work that presents this method is based in applied settings, in particular hydrology.
Theory .
From a more theoretic perspective,
Davison & Smith, 1990 Martins & Stedinger, 2001 Chavez-Demoulin * et al. , 2005 introduce the Poisson-GPD method where they also relate the AEP and ARI .
In Coles, 2001 (Chapter 4.3.3 - Appendix A.1), there is a staple chapter where they introduce the Poisson-GPD method.
In Wang & Holmes, 2020 , the authors discuss some of the key differences between the annual exceedence probability (AEP ) and the average recurrence interval (ARI ).
Birkhäuser Basel (2007) is a another good book that has a few chapters dedicated to BM , POT s and PP s.
Applications .
In Nemukula & Sigauke, 2020 , they apply this to study maximum daily temperature in South Africa where they apply a non-stationary Poisson-GPD .
Thiombiano et al. (2016) study how the Arctic Oscillation and Pacific North American covariates are related to the extreme daily precipitation months in Southeastern Canada where they apply a Poisson-GPD method with spline functions to map the covariates to the GPD parameters.
Silva et al. (2015) study how El Niño-Southern Oscillation can effect the flood regime in the Itajaí river basin in Southern Brasil where they apply a non-stationary Poisson-GPD . Cid et al. , 2015 look at how the North Atlantic Oscillation effect storm surges in the Atlantic and North Atlantic regions where they apply a non-stationary Poisson-GPD .
Katz et al. (2005) investigate ecological disturbances in extremes for paleoecology where they apply a non-stationary Poisson-GPD .
Algorithms .
Silva et al. (2015) showcase how we can use the delta-method (aka Laplace approximation) to calculate uncertainty intervals on the parameters.
MacDonald et al. (2011) consider a Kernel Density estimator for the event occurrences parameterization.