Description Usage Arguments Details Value References Examples
Fits a quantile regression SVM based on the Pinball Loss
1 2 |
x |
An n X m matrix containing the predictors (n = number of observatiosn, m = number of predictors). |
y |
The Response onto which the qrsvm shall be fitted. |
kernel |
A string giving the type of kernels from kernelMatrix. Default value is "rbfdot" for Radial Basis Function Kernel. All Kernels except stringdot supported. |
cost |
The cost parameter see svm and kernelMatrix. |
tau |
The quantile that shall be estimated. 0<=tau<=1. |
sigma, degree, scale, offset, order |
A possible tuning parameter for specific Kernelfunctions, see rbfdot, polydot, vanilladot, tanhdot, laplacedot, besseldot or anovadot. |
There is no preimplemented scaling of the input variables which should be considered beforehand. Also optimization is based on "quadprog:solve.QP" function which can be considerably slow compared to other SVM implementations.
An object of class "qrsvm".
"Nonparametric Quantile Regression" by I.Takeuchi, Q.V. Le, T. Sears, A.J. Smola (2004)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # data generation
n <- 200
x <- as.matrix(seq(-1.5, 1.5, length.out = n))
y <- rnorm(n) * (0.3 + abs(sin(x)))
# fit models
mod005 <- qrsvm(x, y, tau = 0.05)
mod050 <- qrsvm(x, y, tau = 0.5)
mod095 <- qrsvm(x, y, tau = 0.95)
# methods
print(mod050)
summary(mod050)
fittedDf <- data.frame(x, fitted05 = fitted(mod005), fitted50 = fitted(mod050),
fitted95 = fitted(mod095))
predict(mod050, c(-1, 0, 1))
# graph
library(ggplot2)
ggplot(data.frame(x, y), aes(x, y)) + geom_point() +
geom_line(aes(x, fitted05, colour = "P05"), fittedDf) +
geom_line(aes(x, fitted50, colour = "P50"), fittedDf) +
geom_line(aes(x, fitted95, colour = "P95"), fittedDf) +
labs(colour = expression(tau))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.