Learn R Programming

ILSE (version 1.1.7)

kern: Kernel Function

Description

Different type of kernel functions.

Usage

kern(u, type='epk')

Arguments

u

a numeric vector, evluated points in kernel funciton.

type

a optional character string, specify the type of used kernel functionand support 'epk', 'biweight', 'triangle', 'guassian', 'triweight', 'tricube', 'cosine', 'uniform' in current version, defualt as 'epk'.

Value

Return a numeric vector with length equal to 'u'.

Details

Note that K(u_i)=K(X_i-x_0) where u = (X_1-x_0, ..., X_n-x_0) and K_h(u_i)=1/h*K((X_i-x_0)/h) where h is bandwidth.

See Also

KernSmooth package

Examples

Run this code
# NOT RUN {
library(graphics)
u <- seq(-1,1,by=0.01)
(Ku <- kern(u))
plot(u, Ku, type='l')
# guassian kernel
plot(u, kern(u, type='gaussian'), type ='l')
# cosine kernel
plot(u, Ku <- kern(u, type='cosine'), type ='l')
# }

Run the code above in your browser using DataLab