Semiparametric estimation based on the Peaks over Threshold (POT) method.of a distribution with upper and possibly lower tail have the same size as the tail of a generalized Pareto distribution.
1 2 
data 
A numerical vector of sample data values 
Optional Arguments 

one.tail 
Logical which should be set to 
upper 
The value of the upper threshold. A Generalized Pareto
distribution is fitted to the data exceeding this threshold.
If its value is missing, 
lower 
The value of the lower threshold. A Generalized Pareto distribution is fitted to the data below this threshold. If its value is missing, it is estimated so that either 15% of the data samples, or exactly 150 values, whichever number is smaller, is smaller than the lower threshold. 
upper.method 
Character string which can be either "ml" or "lmom" depending upon
the choice of the method used to estimate the parameters of the generalized
Pareto distribution fitted to the part of the data exceeding 
lower.method 
Character string which can be either "ml" or "lmom" depending upon
the choice of the method used to estimate the parameters of the generalized
Pareto distribution fitted to the part of the data below 
plot 
If 
The value of gpd.tail
is an object of class gpd
. It is a list
containing fields: length of the data,
sorted vector of data points, the value of upper threshold, and
estimates of GPD shape and scale parameter for the tail.
and representing
threshold and parameter estimates for the lower tail.
If plot = TRUE
a plot of the exceedences over the threshold against the
quantiles of the estimated GPD is produced for each of the tails studied.
The semiparametric estimation performed by this function was done by the functions
pot.1tail.est
and pot.2tails.est
in the original EVANESCE
library.
These functions were included in the FinMetrics
library of SPlus
under the
name of gpd.tail
to avoid confusion with the similar function gpd
contributed
by Mc Neil. We named it gpd.tail
for backward compatibility
with FinMetrics
.
Rene Carmona, rcarmona@princeton.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  # One tail
data("BCofLRet")
NZ < (BCofLRet !=0)
BLRet < BCofLRet[NZ]
X < BLRet[BLRet > 0]
x.est < gpd.tail(X,one.tail=TRUE,upper=0.04)
y < c(10:500)/1000
plot(y, gpd.1p(y,x.est), log = "x", type = "l")
big.X < sort(X) > 0.01
points((sort(X))[big.X], (ppoints(sort(X)))[big.X])
# random generation from this distribution:
X < BLRet[BLRet != 0]
x.est < gpd.tail(X, upper = 0.015, lower = 0.015, method = "lmom")
n < length(X)
Y < gpd.2q(runif(n), x.est)
plot(X, ylim = c(0.3,0.3))
plot(Y, col = 4, ylim = c(0.3,0.3))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.