# NOT RUN {
theta <- function(t){
0.5+0.25*sin(2*pi*t)
}
n <- 5000
t <- 1:n/n
Theta <- theta(t)
Data <- NULL
Tgrid <- seq(0.01, 0.99, 0.01)
#example with fixed bandwidth
# }
# NOT RUN {
#For computing time purpose
for(i in 1:n){
Data[i] <- rparetomix(1, a = 1/Theta[i], b = 5/Theta[i]+5, c = 0.75, precision = 10^(-5))
}
#example
hgrid <- bandwidth.grid(0.009, 0.2, 20, type = "geometric")
TgridCV <- seq(0.01, 0.99, 0.1)
hcv <- bandwidth.CV(Data, t, TgridCV, hgrid, pcv = 0.99, TruncGauss.kernel,
kpar = c(sigma = 1), CritVal = 3.6, plot = TRUE)
Tgrid <- seq(0.01, 0.99, 0.01)
hillTs <- hill.ts(Data, t, Tgrid, h = hcv$h.cv, kernel = TruncGauss.kernel,
kpar = c(sigma = 1), CritVal = 3.6,gridlen = 100, initprop = 1/10, r1 = 1/4, r2 = 1/20)
plot(hillTs$Tgrid, hillTs$Theta, xlab = "t", ylab = "Estimator of theta")
lines(t, Theta, col = "red")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab