File: predict.kqr.Rd

package info (click to toggle)
r-cran-kernlab 0.9-33-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,216 kB
  • sloc: cpp: 6,011; ansic: 935; makefile: 2
file content (51 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (5)
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
\name{predict.kqr}
\alias{predict.kqr}
\alias{predict,kqr-method}
\title{Predict method for kernel Quantile Regression object}


\description{Prediction of test data for kernel quantile regression}


\usage{
\S4method{predict}{kqr}(object, newdata)
}

\arguments{

  \item{object}{an S4 object of class \code{kqr} created by the
    \code{kqr} function}
  \item{newdata}{a data frame, matrix, or kernelMatrix containing new data}
}

\value{The value of the quantile given by the computed \code{kqr}
  model in a vector of length equal to the the rows of \code{newdata}.
   }

\author{Alexandros Karatzoglou\cr
  \email{alexandros.karatzoglou@ci.tuwien.ac.at}}
   
\keyword{methods}
\keyword{regression}


\examples{
# create data
x <- sort(runif(300))
y <- sin(pi*x) + rnorm(300,0,sd=exp(sin(2*pi*x)))

# first calculate the median
qrm <- kqr(x, y, tau = 0.5, C=0.15)

# predict and plot
plot(x, y)
ytest <- predict(qrm, x)
lines(x, ytest, col="blue")

# calculate 0.9 quantile
qrm <- kqr(x, y, tau = 0.9, kernel = "rbfdot",
           kpar= list(sigma=10), C=0.15)
ytest <- predict(qrm, x)
lines(x, ytest, col="red")
}