Learn R Programming

⚠️There's a newer version (4.2) of this package.Take me there.

rqPen: Penalized quantile regression

Overview

This R package provides tools for estimating a quantile regression model with a penalized objective function. Implements a variety of penalties, including group penalties.

Installation

For most up to date versions use the following code. However, be warned the github package is often in a state of testing and debugging.

devtools::install_github("bssherwood/rqpen")

Example

library(rqPen)
n<- 200
p<- 30
x0<- matrix(rnorm(n*p),n,p)
X<- cbind(x0, x0^2, x0^3)[,order(rep(1:p,3))]
y<- -2+X[,1]+0.5*X[,2]-X[,3]-0.5*X[,7]+X[,8]-0.2*X[,9]+rt(n,2)
group<- rep(1:p, each=3)

# lasso estimation
# one tau
fit1 <- rq.pen(x,y)
# several values of tau
fit2 <- rq.pen(x,y,tau=c(.2,.5,.8))

# Group SCAD estimation
fit3 <- rq.group.pen(x,y,groups=group,penalty="gSCAD")

# cross validation
cv1 <- rq.pen.cv(x,y)
plot(cv1)

cv2 <- rq.pen.cv(x,y,tau=c(.2,.5,.8))
plot(cv2)

cv3 <- rq.group.pen(x,y,groups=group,penalty="gSCAD")
plot(cv3)

# BIC selection of tuning parameters
qs1 <- qic.select(fit1)
qs2 <- qic.select(fit2)
qs3 <- qic.select(fit3)

See, https://github.com/bssherwood/rqpen/blob/master/ignore/rqPenArticle.pdf, for a vignette. The Huber approach for rq.pen relies on the R package hqreg and work presented in "Semismooth Newton Coordinate Descent Algorithm for Elastic-Net Penalized Huber Loss Regression and Quantile Regression". The Huber approach in rq.group.pen relies on R package hrqglas and work presented in An Efficient Approach to Feature Selection and Estimation for Quantile Regression with Grouped Variables

References

Sherwood, B. and Li, S. (2022) An Efficient Approach to Feature Selection and Estimation for Quantile Regression with Grouped Variables, Statistics and computing, 75.

Yi, C. and Huang, J. (2015) Semismooth Newton Coordinate Descent Algorithm for Elastic-Net Penalized Huber Loss Regression and Quantile Regression, Journal of Computational and Graphical Statistics, 26:3, 547-557.

Copy Link

Version

Install

install.packages('rqPen')

Monthly Downloads

732

Version

3.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Ben Sherwood

Last Published

July 17th, 2023

Functions in rqPen (3.2)

print.cv.rq.pen

Prints a cv.rq.pen object.
rq.pen

Fit a quantile regression model using a penalized quantile loss function.
predict.rq.pen.seq.cv

Predictions from rq.pen.seq.cv object
qic.select.rq.pen.seq

Select tuning parameters using IC
rq.nc.fit

Non-convex penalized quantile regression
cv.rq.pen

Cross Validated quantile regression
print.qic.select

Print a qic.select object
QICD.nonpen

Implements QICD algorithm with some variables not being penalized
plot.rq.pen.seq

Plot of coefficients of rq.pen.seq object as a function of lambda
plot.rq.pen.seq.cv

Plots cross validation results from a rq.pen.seq.cv object
qic.select.rq.pen.seq.cv

Select tuning parameters using IC
QICD

Implements QICD algorithm
print.rq.pen

Prints an rq.pen object
coef.rq.pen.seq

Returns coefficients of a rq.pen.seq object
coef.rq.pen.seq.cv

Returns coefficients from a rq.pen.seq.cv object.
rqPen

rqPen: A package for estimating quantile regression models using penalized objective functions.
rq.pen.cv

Does k-folds cross validation for rq.pen. If multiple values of a are specified then does a grid based search for best value of \(\lambda\) and a.
cv_plots

Plots of cross validation results as a function of lambda.
plot.cv.rq.group.pen

Cross validation plot for cv.rq.group.pen object
print.rq.pen.seq

Print a rq.pen.seq object
predict.qic.select

Predictions from a qic.select object
predict.cv.rq.pen

Prediction for a cv.rq.pen object
qic

Calculate information criterion for penalized quantile regression models. Currently not exported.
bytau.plot.rq.pen.seq.cv

Plot of coefficients varying by quantiles for rq.pen.seq.cv object
qic.select

Select tuning parameters using IC
rq.group.pen.cv

Performs cross validation for a group penalty. #'
bytau.plot.rq.pen.seq

Plot of how coefficients change with tau.
rq.group.pen

Fits quantile regression models using a group penalized objective function.
print.rq.pen.seq.cv

Prints a rq.pen.seq.cv object
rq.lasso.fit

Estimates a quantile regression model with a lasso penalized quanitle loss function.
predict.rq.pen.seq

Predictions from rq.pen.seq object
predict.rq.pen

Prediction for a rq.pen object
rq.group.fit

Estimates a quantile regression model with a group penalized objective function.
beta_plots

Plots of coefficients by lambda for cv.rq.group.pen and cv.rq.pen
coef.cv.rq.pen

Returns Coefficients of a cv.rq.pen object
coef.cv.rq.group.pen

Coefficients from a cv.rq.group.pen object
cv.rq.group.pen

Old cross validation function for group penalty
bytau.plot

Plot of how coefficients change with tau