I need the R code for setting a threshold while fitting a generalized Pareto distribution.
Asked
Active
Viewed 131 times
-1
-
What have you tried? Also see https://stackoverflow.com/help/how-to-ask and https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – mikeck Apr 27 '20 at 01:17
1 Answers
1
I've just made a R package which exactly serves this purpose, namely gfiExtremes (now also on CRAN).
remotes::install_github("stla/gfiExtremes", build_vignettes = TRUE)
It allows to perform inference on the quantiles for a generalized Pareto distribution model and on the parameters of the Pareto exceedance distribution, with or without assuming the exceedance threshold is known.
Usage
The data must be given as a numeric vector, say x
.
library(gfiExtremes)
gf <- gfigpd2(x, beta = c(0.99, 0.995, 0.999))
summary(gf) # provides estimates and confidence intervals of the beta-quantiles
thresholdEstimate(gf) # an estimate of the threshold
See the examples in the package documentation and the vignette for more info.

desertnaut
- 57,590
- 26
- 140
- 166

Stéphane Laurent
- 75,186
- 15
- 119
- 225