-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkern.Rd
35 lines (35 loc) · 897 Bytes
/
kern.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
\name{kern}
\alias{kern}
\title{Kernel Function}
\description{
Different type of kernel functions.
}
\usage{
kern(u, type='epk')
}
\arguments{
\item{u}{a numeric vector, evluated points in kernel funciton.}
\item{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'.}
}
\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.
}
\value{
Return a numeric vector with length equal to 'u'.
}
\author{
Liu Wei
}
\seealso{
KernSmooth package
}
\examples{
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')
}