# rq.group.fit: Quantile Regresion with Group Penalty In rqPen: Penalized Quantile Regression

## Description

Similar to cv.rq.pen function, but uses group penalty. Group penalties use the L1 norm instead of L2 for computational convenience. As a result of this the group lasso penalty is the same as the typical lasso penalty and thus you should only use a SCAD or MCP penalty. Only the SCAD and MCP penalties incorporate the group structure into the penalty. The group lasso penalty is implemented because it is needed for the SCAD and MCP algorithm. We use a group penalty extension of the QICD algorithm presented by Peng and Wang (2015).

## Usage

 ```1 2``` ```rq.group.fit(x, y, groups, tau = 0.5, lambda, intercept = TRUE, penalty = "SCAD", alg = "QICD", a=3.7, penGroups=NULL, ...) ```

## Arguments

 `x` Matrix of predictors. `y` Vector of response values. `groups` Vector assigning columns of x to groups. `tau` Conditional quantile being modelled. `lambda` Vector of lambdas. Default is for lambdas to be automatically generated. `intercept` Whether model should include an intercept. Constant does not need to be included in "x". `penalty` Type of penalty: "SCAD" or "MCP". `alg` If set to QICD algorithm will use coordinate descent algorithm. Otherwise, will use a linear programming algorithm, which is an extension of algorithm used in rq.lasso.fit. `a` The additional tuning parameter for SCAD and MCP. `penGroups` Specify which groups will be penalized. Default is to penalize all groups. `...` Additional arguments to be sent to rq.lasso.fit or groupQICD.

## Value

Returns the following:

 `coefficients` Coefficients of the model. `residuals` Residuals from the fitted model. `rho` Unpenalized portion of the objective function. `tau` Quantile being modeled. `n` Sample size. `intercept` Whether intercept was included in model.

## References

[1] Yuan, M. and Lin, Y. (2006). Model selection and estimation in regression with grouped variables. J. R. Statist. Soc. B, 68, 49-67.

[2] Peng, B. and Wang, L. (2015). An Iterative Coordinate Descent Algorithm for High-Dimensional Nonconvex Penalized Quantile Regression. Journal of Computational and Graphical Statistics, 24, 676-694.

## Examples

 ```1 2 3``` ```x <- matrix(rnorm(800),nrow=100) y <- 1 + x[,1] - 3*x[,5] + rnorm(100) cv_model <- rq.group.fit(x,y,groups=c(rep(1,4),rep(2,4)),lambda=1,penalty="SCAD") ```

### Example output

```Loading required package: quantreg

Attaching package: 'SparseM'

The following object is masked from 'package:base':

backsolve