bandwidth.CV {extremefit} | R Documentation |
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 |
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 |
plot |
If |
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 |
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
bandwidth.grid
, CriticalValue
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)