# NOT RUN {
#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
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab