Homepage

Extreme Value Theory using R texmex package

19/04/2020

TAGS: evt, r, ggplot2

Generalized Pareto Distribution

Foreword

GPD modelling proceeds by selecting a threshold above which the data appear to be well modelled. Standard tools for threshold selection that appear in the literature include the Mean Residual Life (MRL) plot. For a suitably chosen threshold, the mean residual life plot should be linear and the parameter estimates in threshold stability plots constant above the chosen threshold (both of these requirements are assessed by taking account of sampling variability).

Mean Residual Life plot

This plot is usually displayed using mrlplot from the evd package. However, it is possible to have a more appealing plot using the texmex package. As simple as this:

mrl_data <- mrl(data)
ggplot(mrl_data) + ggtitle("MRL plot")

mrl

Considering the previous plot, we can define the threshold to be around 2.8, as it marks the end of linearity in the MRL plot and is low enough to have enough points for GPD modelling.

Threshold Choice plot

grf_data <- gpdRangeFit(data)
p <- ggplot(grf_data)
grid.arrange(p[[1]] + ggtitle("Stability plot, scale parameter"),
             p[[2]] + ggtitle("Stability plot, shape parameter"),
             ncol=2)

tcp

GPD fitting

data_fit <- evm(data, th=3)
ggplot(data_fit)