I am trying to build a quantile regression model and I found the conquer
package, which provides very good and fast results. However, I am interested in building the model without the intercept, and so far I have been unable to see how to do this. Here I leave a small example building a model with intercept.
library(conquer)
# Generate data
set.seed(123)
n <- 1000
p <- 10
X <- matrix(rnorm(n * p), ncol = p)
beta <- 1:10
eps <- rnorm(n, sd = 0.1)
y <- 5 + X %*% beta + eps
# Build model with intercept
model = conquer::conquer(X, y, tau=0.5)
model$coeff
# Output
[1] 0.002836087 0.998385395 2.003804166 3.002418061 4.005477795 5.002657035 5.999809986 6.996086391 8.002274846 9.001753836 10.004951051
Here I create a dataframe with 10 variables, and conquer returns 11 coefficients, one per variable and an extra one for the intercept. I know that in other packages like quantreg
one can control if the model is built with or without intercept as shown here:
quantreg_with_intercept = quantreg::rq(y~X, tau=0.5)
quantreg_without_intercept = quantreg::rq(y~-1+X, tau=0.5)
Is there a way to do the same with conquer
?