# NOT RUN {
set.seed(1)
# Data simulation
n = 25 # Dataset size
data.X = runif(n,min=0,max=5) # X
data.Y = 0.2*data.X^2-data.X+2+rnorm(n,mean=0,sd=0.3) # Y
########################################################################
# Bandwidth selection under H0
# We generate a dataset under H0 to estimate the optimal bandwidth under H0
linkfunction.H0 = function(x){0.2*x^2-x+2}
data.X.H0 = runif(n,min=0,max=5)
data.Y.H0 = linkfunction.H0(data.X.H0)+rnorm(n,mean=0,sd=0.3)
h.opt.vkgmss = vkgmss.bandwidth.selection.linkfunction(data.X.H0 , data.Y.H0,linkfunction.H0)
# }
Run the code above in your browser using DataCamp Workspace