Description Usage Arguments Details Value References Examples
Fits multiple Quantile Regression SVM
1 2 3 |
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 quantiles 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. |
doPar |
Should a parallel backend be used. Logical. |
clustnum |
The number of parallel tasks to use given doPar==TRUE. Default = 2. |
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 "multqrsvm"
"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(-2, 2, length.out = n))
y <- rnorm(n)*(0.3 + abs(sin(x)))
# fit models
quant <- c(0.01, 0.25, 0.5, 0.75, 0.99)
models <- multqrsvm(x, y, tau = quant, doPar = FALSE, sigma = 1)
# methods
print(models)
fittedDf <- data.frame(cbind(x, fitted(models)))
names(fittedDf) <- c("x", sprintf("fitted_%02i", quant * 100))
predict(models, c(-1, 0, 1))
# graph
library(ggplot2)
g <- ggplot(data.frame(x, y), aes(x, y)) + geom_point()
for (i in seq_along(models)) {
mapping <- aes_string("x", names(fittedDf)[i+1])
mapping$colour <- sprintf("P%02i", quant[i] * 100)
g <- g + geom_line(mapping, fittedDf)
}
g + labs(colour = expression(tau))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.