gpdSeqTests: GPD Multiple Threshold Goodness-of-Fit Testing

Description Usage Arguments Details Value Examples

View source: R/gpdSeqTests.R

Description

Wrapper function to test multiple thresholds for goodness-of-fit to the Generalized Pareto model. Can choose which test to run from the available tests in this package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
gpdSeqTests(
  data,
  thresholds = NULL,
  nextremes = NULL,
  method = c("ad", "cvm", "pbscore", "multscore", "imasym", "impb"),
  nsim = NULL,
  inner = NULL,
  outer = NULL,
  information = c("expected", "observed"),
  allowParallel = FALSE,
  numCores = 1
)

Arguments

data

Original, full dataset in vector form.

thresholds

A set of threshold values (either this or a set of the number of extremes must be given, but not both). Must be provided as a vector.

nextremes

A set of the number of upper extremes to be used, provided as a vector.

method

Which test to run to sequentially test the thresholds. Must be one of ‘ad’, ‘cvm’, ‘pbscore’, ‘multscore’, ‘imasym’, or ‘impb’.

nsim

Number of boostrap replicates for the ‘ad’, ‘cvm’, ‘pbscore’, ‘multscore’, and ‘imasym’ tests.

inner

Number of inner boostrap replicates if ‘impb’ test is chosen.

outer

Number of outer boostrap replicates if ‘impb’ test is chosen.

information

To use observed or expected (default) information for the ‘pbscore’ and ‘multscore’ tests.

allowParallel

If selected, should the ‘cvm’, ‘ad’, ‘pbscore’, or ‘impb’ procedure be run in parallel or not. Defaults to false.

numCores

If allowParallel is true, specify the number of cores to use.

Details

Function returns a matrix containing the thresholds used, the number of observations above each threshold, the corresponding test statistics, p-values (raw and transformed), and parameter estimates at each threshold. The user must provide the data, a vector of thresholds or number of upper extremes to be used, and select the test.

Value

threshold

The threshold used for the test.

num.above

The number of observations above the given threshold.

p.values

Raw p-values for the thresholds tested.

ForwardStop

Transformed p-values according to the ForwardStop stopping rule.

StrongStop

Transformed p-values according to the StrongStop stopping rule.

statistic

Returned test statistics of each individual test.

est.scale

Estimated scale parameter for the given threshold.

est.shape

Estimated shape parameter for the given threshold.

Examples

1
2
3
4
5
set.seed(7)
x <- rgpd(10000, loc = 0, scale = 5, shape = 0.2)
## A vector of thresholds to test
threshes <- c(1.5, 2.5, 3.5, 4.5, 5.5)
gpdSeqTests(x, thresholds = threshes, method = "ad")

Example output

  testnum threshold num.above  p.values ForwardStop StrongStop statistic
1       1       1.5      7487 0.2725720   0.8337505  0.7710744 0.5244226
2       2       2.5      6253 0.8300439   0.9626280  0.9199867 0.2464315
3       3       3.5      5224 0.5783037   0.6927657  1.0219718 0.3485234
4       4       4.5      4371 0.3657002   0.6074136  0.9270279 0.4569545
5       5       5.5      3714 0.5321435   0.7595937  0.9866237 0.3689956
  est.scale est.shape
1  5.254336 0.2139366
2  5.382598 0.2221351
3  5.568994 0.2252624
4  5.841078 0.2208929
5  5.964935 0.2294259

eva documentation built on Jan. 13, 2021, 8:34 p.m.