File: FKS.Rd

package info (click to toggle)
r-cran-ddalpha 1.3.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,656 kB
  • sloc: cpp: 3,556; fortran: 886; ansic: 159; makefile: 2
file content (64 lines) | stat: -rw-r--r-- 2,087 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
\name{FKS}
\alias{FKS}
\title{Fast Kernel Smoothing}
\usage{
FKS(dataf, Tout, kernel = c("uniform", "triangular", "Epanechnikov",
  "biweight", "triweight", "Gaussian"), m = 51, K = 20)
}
\arguments{
\item{dataf}{A set of functional data given by a \code{dataf} object that are to be smoothed.}

\item{Tout}{vector of values in the domain of the functions at which the
resulting smoothed function is evaluated}

\item{kernel}{Kernel used for smoothing. Admissible values are \code{uniform}, 
\code{triangular}, \code{Epanechnikov}, \code{biweight}, \code{triweight} and \code{Gaussian}.
By default, \code{uniform} is used.}

\item{m}{Number of points in the grid for choosing the cross-validated bandwidth.}

\item{K}{Performs \code{K}-fold cross-validation based on randomly shuffled data.}
}
\value{
A \code{dataf} object corresponding to \code{Tout} of smoothed functional values.
}
\description{
Produces a kernel smoothed version of a function based on
the vectors given in the input. Bandwidth is selected using cross-validation.
}
\details{
A vector of the same length as \code{Tout}
corresponding to the values of the
function produced using kernel smoothing, is provided. Bandwidth is selected using the
\code{K}-fold cross-validation of randomly shuffled input values.
}
\examples{
d = 10
T = sort(runif(d))
X = T^2+ rnorm(d,sd=.1)
Tout = seq(0,1,length=101)

plot(T,X)
dataf = list(list(args=T,vals=X))
data.sm = FKS(dataf,Tout,kernel="Epan")
lines(data.sm[[1]]$args,data.sm[[1]]$vals,col=2)

datafs = structure(list(dataf=dataf,labels=1:length(dataf)),class="functional")
plot(datafs)
points(T,X)
data.sms = structure(list(dataf=data.sm,labels=1:length(data.sm)),class="functional")
plot(data.sms)

n = 6
dataf = list()
for(i in 1:n) dataf[[i]] = list(args = T<-sort(runif(d)), vals = T^2 + rnorm(d,sd=.1))
data.sm = FKS(dataf,Tout,kernel="triweight")
data.sms = structure(list(dataf=data.sm,labels=1:length(data.sm)),class="functional")
plot(data.sms)
}
\author{
Stanislav Nagy, \email{nagy at karlin.mff.cuni.cz}
}
\keyword{functional}
\keyword{kernel}
\keyword{smoothing}