Prediction of test data for kernel quantile regression

# S4 method for class 'kqr'
predict(object, newdata)

Arguments

object

an S4 object of class kqr created by the kqr function

newdata

a data frame, matrix, or kernelMatrix containing new data

Value

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

Author

Alexandros Karatzoglou
alexandros.karatzoglou@ci.tuwien.ac.at

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)
#> Using automatic sigma estimation (sigest) for RBF or laplace kernel 
#> Error in solve.default(AP, c(c.x, c.y)): system is computationally singular: reciprocal condition number = 1.29556e-16

# predict and plot
plot(x, y)

ytest <- predict(qrm, x)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'predict': object 'qrm' not found
lines(x, ytest, col="blue")
#> Error: object 'ytest' not found

# calculate 0.9 quantile
qrm <- kqr(x, y, tau = 0.9, kernel = "rbfdot",
           kpar= list(sigma=10), C=0.15)
#> Error in solve.default(AP, c(c.x, c.y)): system is computationally singular: reciprocal condition number = 8.56736e-20
ytest <- predict(qrm, x)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'predict': object 'qrm' not found
lines(x, ytest, col="red")
#> Error: object 'ytest' not found