Learn R Programming

extremefit (version 1.0.2)

bootCI.ts: Pointwise confidence intervals by bootstrap

Description

Pointwise quantiles and survival probabilities confidence intervals using bootstrap.

Usage

bootCI.ts(X, t, Tgrid, h, kernel = TruncGauss.kernel, kpar = NULL,
  prob = 0.99, threshold = quantile(X, 0.99), B = 100,
  alpha = 0.05, type = "quantile", CritVal = 3.6, initprop = 1/10,
  gridlen = 100, r1 = 1/4, r2 = 1/20, plot = F)

Arguments

X

a vector of the observed values.

t

a vector of time covariates which should have the same length as X.

Tgrid

a sequence of times used to perform the cross validation (can be any sequence in the interval [min(t) , max(t)] ).

h

a bandwidth value (vector values are not admitted).

kernel

a kernel function used to compute the weights in the time domain, with default the truncated gaussian kernel.

kpar

a value for the kernel function parameter, with no default value.

prob

used if type = "quantile", a scalar value in \([0,1]\) which determines the quantile order (vector values are not admitted).

threshold

used if type = "survival", a scalar value in the domain of X.

B

an integer giving the number of bootstrap iterations.

alpha

the type 1 error of the bootstrap (1-\(alpha\))-confidence interval.

type

type is either "quantile" or "survival".

CritVal

a critical value associated to the kernel function given by CriticalValue. The default value is 3.6 corresponding to the truncated Gaussian kernel.

gridlen, initprop, r1, r2

parameters used in the function hill.adapt (see hill.adapt).

plot

If TRUE, the bootstrap confidence interval is plotted.

Value

LowBound

the lower bound of the bootstrap (1-\(alpha\))-confidence interval.

UppBound

the upper bound of the bootstrap (1-\(alpha\))-confidence interval of level.

Warning

The executing time of the function can be time consuming if the B parameter or the sample size are high (B=100 and the sample size = 5000 for example) .

Details

For each point in \(Tgrid\), generate B samples of \(X\) with replacement to estimate the quantile of order \(prob\) or the survival probability beyond \(threshold\). Determine the bootstrap pointwise (1-\(alpha\))-confidence interval for the quantiles or the survival probabilities.

The kernel implemented in this packages are : Biweight kernel, Epanechnikov kernel, Rectangular kernel, Triangular kernel and the truncated Gaussian kernel.

See Also

hill.ts,predict.hill.ts, Biweight.kernel, Epa.kernel, Rectangular.kernel, Triang.kernel, TruncGauss.kernel

Examples

Run this code
# NOT RUN {
theta <- function(t){
   0.5+0.25*sin(2*pi*t)
 }
n <- 5000
t <- 1:n/n
Theta <- theta(t)
set.seed(123)
Data <- NULL
for(i in 1:n){
   Data[i] <- rparetomix(1, a = 1/Theta[i], b = 1/Theta[i]+5, c = 0.75)
 }
Tgrid <- seq(1, length(Data)-1, length = 20)/n
h <- 0.1
# }
# NOT RUN {
 #For computing time purpose
  bootCI.ts(Data, t, Tgrid, h, kernel = TruncGauss.kernel, kpar = c(sigma = 1),
            CritVal = 3.6, threshold = 2, type = "survival", B = 100, plot = TRUE)
  true.p <- NULL
  for(i in 1:n){
     true.p[i] <- 1-pparetomix(2, a = 1/Theta[i], b = 1/Theta[i]+5, c = 0.75)
   }
  lines(t, true.p, col = "red")
  bootCI.ts(Data, t, Tgrid, h, kernel = TruncGauss.kernel, kpar = c(sigma = 1),
 prob = 0.999, type = "quantile", B = 100, plot = TRUE)
  true.quantile <- NULL
  for(i in 1:n){
     true.quantile[i] <- qparetomix(0.999, a = 1/Theta[i], b = 1/Theta[i]+5, c = 0.75)
   }
  lines(t, log(true.quantile), col = "red")
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab