vkde: Variable Kernel Density Estimation

Description Usage Arguments Details Value Examples

Description

This is the description of the function vkde.

Usage

1
vkde(tdat, edat, bwtype, h, p = 1, verbose = F)

Arguments

tdat

a vector containing the training dataset.

edat

a vector containing the evaluation data points.

bwtype

a string corresponding to the method for calculating bandwidths. Either 'fixed', 'balloon' or 'sampleSmoothing'.

h

the bandwidth(s) of the kernels. It should be a scalar when 'bwtype=fixed', a vector of length length(edat) for 'bwtype=balloon', a vector of length length(tdat) for 'bwtype=sampleSmoothing'. It can be calculated from other functions in this package.

Details

These are the details of the function.

Value

The density at locations edat based on the training dataset tdat following the method specified by bwtype. The bandwidths h can be calculated from other functions in this package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
evalVect <- seq(from=-5,to=5,by=0.1)
trainingVect <- runif(5,min = -1,max = 2)
kernelVect <- vkde(tdat=trainingVect,edat=evalVect,'fixed',1)
plot(evalVect,kernelVect$kde,
     type='l',
     xlab = 'x',ylab='kernel density estimate')
axis(1,trainingVect,labels = NA,lwd.ticks = 2,col.ticks = 'red',tck=0.1)
for(i in 1:length(trainingVect)){
  lines(evalVect,kernelVect$individualKernels[i,],lty=2)
}

kcucchi/vdke documentation built on May 20, 2019, 8:28 a.m.