# 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
for(i in 1:n){Data[i]<-rparetomix(1,a=1/Theta[i],b=5/Theta[i]+5,c=0.75,precision=10^(-5))}
# }
# NOT RUN {
#For computing time purpose
#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, TruncGauss.kernel, kpar = c(sigma = 1),
CritVal = 3.6, gridlen = 100, initprop = 1/10, r1 = 1/4, r2 = 1/20)
goftest(hillTs, Data, t, plot = TRUE)
# we observe that for this data, the null hypothesis that the tail
# is fitted by a Pareto distribution is not rejected
# for all points on the Tgrid
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab