Learn R Programming

hqreg (version 1.4-1)

hqreg-package: Regularization Paths for Lasso or Elastic-net Penalized Huber Loss Regression and Quantile Regression

Description

Efficient algorithms for fitting regularization paths for lasso or elastic-net penalized regression models with Huber loss, quantile loss or squared loss.

Arguments

Author

Congrui Yi <eric.ycr@gmail.com>

Details

Package:hqreg
Type:Package
Version:1.4-1
Date:2024-09-23
License:GPL-3

Very simple to use. Accepts X,y data for regression models, and produces the regularization path over a grid of values for the tuning parameter lambda. Also provides functions for plotting, prediction and parallelized cross-validation.

References

Yi, C. and Huang, J. (2017) Semismooth Newton Coordinate Descent Algorithm for Elastic-Net Penalized Huber Loss Regression and Quantile Regression, tools:::Rd_expr_doi("10.1080/10618600.2016.1256816")
Journal of Computational and Graphical Statistics

Examples

Run this code
X = matrix(rnorm(1000*100), 1000, 100)
beta = rnorm(10)
eps = 4*rnorm(1000)
y = drop(X[,1:10] %*% beta + eps) 

# Huber loss
fit1 = hqreg(X, y)
coef(fit1, 0.01)
predict(fit1, X[1:5,], lambda = c(0.02, 0.01))
cv.fit1 = cv.hqreg(X, y)
plot(cv.fit1)

# Quantile loss
fit2 = hqreg(X, y, method = "quantile", tau = 0.2)
plot(fit2)

# Squared loss
fit3 = hqreg(X, y, method = "ls", preprocess = "rescale")
plot(fit3, xvar = "norm")

Run the code above in your browser using DataLab