Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bandwidth.CV

Choice of the bandwidth by cross validation.


Description

Choose a bandwidth by minimizing the cross validation function.

Usage

bandwidth.CV(X, t, Tgrid, hgrid, pcv = 0.99,
  kernel = TruncGauss.kernel, kpar = NULL, CritVal = 3.6,
  plot = FALSE)

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)] ).

hgrid

a sequence of values from which the bandwidth is selected.

pcv

a probability value which determines the level of quantiles used to perform the cross validation, with default 0.99.

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.

CritVal

a critical value associated to the kernel function computed from the function CriticalValue, with default 3.6 corresponding to the truncated Gaussian kernel.

plot

If TRUE, the cross validation function is plotted.

Details

The sequence hgrid must be geometric. (see bandwidth.grid to generate a geometric grid of bandwidths).

The value pcv should be scalar (vector values are not admitted).

Value

hgrid

the sequence of bandwidth given in input.

CV

the values of the cross validation function for hgrid.

h.cv

the bandwidth that minimizes the cross-validation function.

Author(s)

Durrieu, G., Grama, I., Jaunatre, K., Pham, Q. and Tricot, J.- M

References

Durrieu, G. and Grama, I. and Pham, Q. and Tricot, J.- M (2015). Nonparametric adaptive estimator of extreme conditional tail probabilities quantiles. Extremes, 18, 437-478.

See Also

Examples

#Generate the data
theta <- function(t){
   0.5+0.25*sin(2*pi*t)
 }
n <- 5000
t <- 1:n/n
Theta <- theta(t)
Data <- NULL
for(i in 1:n){
   Data[i] <- rparetomix(1, a = 1/Theta[i], b = 1/Theta[i]+5, c = 0.75)
 }

#compute the cross validation bandwidth
Tgrid <- seq(0, 1, 0.02) #define a grid to perform the cross validation
hgrid <- bandwidth.grid(0.1, 0.3, 20) #define a grid of bandwidths
## Not run:  #For computation time purpose
  Hcv <- bandwidth.CV(Data, t, Tgrid, hgrid, pcv = 0.99, plot = TRUE)
  #The computing time can be long
  Hcv

## End(Not run)

extremefit

Estimation of Extreme Conditional Quantiles and Probabilities

v1.0.2
GPL-2
Authors
Gilles Durrieu, Ion Grama, Kevin Jaunatre, Quang-Khoai Pham, Jean-Marie Tricot
Initial release
2019-05-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.