kqr performs
non-parametric Quantile Regression.## S3 method for class 'formula':
kqr(x, data=NULL, ..., subset, na.action = na.omit, scaled = TRUE)## S3 method for class 'vector':
kqr(x,...)
## S3 method for class 'matrix':
kqr(x, y, scaled = TRUE, tau = 0.5, C = 0.1, kernel = "rbfdot", kpar = "automatic",
reduced = FALSE, rank = dim(x)[1]/6, fit = TRUE, cross = 0, na.action = na.omit)
## S3 method for class 'kernelMatrix':
kqr(x, y, tau = 0.5, C = 0.1, fit = TRUE, cross = 0)
## S3 method for class 'list':
kqr(x, y, tau = 0.5, C = 0.1, kernel = "strigdot", kpar= list(length=4, C=0.5),
fit = TRUE, cross = 0)
kernelMatrix
of the training data or a list of character vectorkqr is called from.scaled is of length 1, the value is recycled as
many times as needed and all non-binary variables are scaled.
Per default, data are scaled internally (both x kernlab provides the most popular kernel functions
which can sigmainverse kernel width for the Radial Basis
kqr with large datasets since normally an nreduced is TRUE(default :
dim(x)[1]/6)NAs are
found. The default action is na.omit, which leads to
rejection of cases with missing values on any required variable. An
alternative is na.fail, which kqr containing the fitted model along with
information.Accessor functions can be used to access the slots of the
object which include :coef.kqr-class for more details.ipop implemented in kernlab.predict.kqr, kqr-class, ipop, rvm, ksvm# 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")
# calculate 0.1 quantile
qrm <- kqr(x, y, tau = 0.1,C=0.15)
ytest <- predict(qrm, x)
lines(x, ytest, col="green")
# print first 10 model coefficients
coef(qrm)[1:10]Run the code above in your browser using DataLab