Function to produce diagnostic plots and test statistics for the threshold diagnostics exploiting structure of maximum likelihood estimators based on the non-homogeneous Poisson process likelihood or the coefficient of tail dependence
Usage
thselect.wseq(
  xdat,
  thresh,
  quantile,
  model = c("nhpp", "taildep", "rtaildep"),
  npp = 1,
  nsim = 1000L,
  level = 0.95,
  plot = FALSE,
  ...
)Arguments
- xdat
- a numeric vector or matrix of data to be fitted. 
- thresh
- vector of candidate thresholds. 
- quantile
- vector of probabilities for empirical quantiles used in place of the threshold, used if argument - threshis missing.
- model
- string specifying whether the univariate or multivariate diagnostic should be used. Either - nhppfor the univariate model, or- exp(- invexp) for the bivariate exponential model with rate (inverse rate) parametrization. See details.
- npp
- number of observations per period for the non-homogeneous point process model. Default to 1. 
- nsim
- number of Monte Carlo simulations used to assess the null distribution of the test statistic 
- level
- confidence level of intervals, defaults to 0.95 
- plot
- logical; if - TRUE, calls the plot routine
- ...
- additional parameters passed to internal routine 
Value
an object of class invisible list with components
- thresh0: threshold selected by the likelihood ratio procedure
- thresh: vector of candidate thresholds
- coef: maximum likelihood estimates from all thresholds
- vcov: joint asymptotic covariance matrix for shape \(\xi\) or coefficient of tail dependence \(\eta\), or it's reciprocal.
- wn: values of the white noise process
- stat: value of the likelihood ratio test statistic for the changepoint test
- pval: P-value of the likelihood ratio test
- mle: maximum likelihood estimates for the selected threshold
- model: model fitted, either- nhpp,- expor- invexp
- nsim: number of Monte Carlo simulations for changepoint test
- xdat: vector of observations
Details
The function is a wrapper for the univariate (non-homogeneous Poisson process model) and exponential dependence model applied to the minimum component (tail dependence coefficient).
For the latter, the user can select either the rate ("taildep" or inverse rate parameter  ("rtaildep"). The inverse rate parametrization  works better for uniformity of the p-value distribution under the likelihood ratio test for the changepoint.
For the coefficient of tail dependence, users must provide pairwise minimum of marginally exponentially distributed margins (see example)
References
Wadsworth, J.L. (2016). Exploiting Structure of Maximum Likelihood Estimators for Extreme Value Threshold Selection, Technometrics, 58(1), 116-126, http://dx.doi.org/10.1080/00401706.2014.998345.
Examples
if (FALSE) { # \dontrun{
set.seed(123)
xdat <- abs(rnorm(5000))
thresh <- quantile(xdat, seq(0, 0.9, by = 0.1))
(diag <- thselect.wseq(
 xdat = xdat,
 thresh = thresh,
 plot = TRUE,
 type = "ps"))
# Multivariate example, with coefficient of tail dependence
xbvn <- mvrnorm(n = 6000L,
                mu = rep(0, 2),
                Sigma = cbind(c(1, 0.7), c(0.7, 1)))
thselect.wseq(
  xdat = xbvn,
  quantile = seq(0, 0.9, length.out = 30),
  model = 'taildep',
  plot = TRUE)
#inverse rate parametrization
} # }