# lars.c: Constrained LARS Coefficient Function (Equality Constraints) In PACLasso: Penalized and Constrained Lasso Optimization

## Description

This function computes the PaC constrained LASSO coefficient paths following the methodology laid out in the PaC paper. This function could be called directly as a standalone function, but the authors recommend using `lasso.c` for any implementation. This is because `lasso.c` has additional checks for errors across the coefficient paths and allows for users to go forwards and backwards through the paths if the paths are unable to compute in a particular direction for a particular run.

## Usage

 ```1 2 3``` ```lars.c(x, y, C.full, b, l.min = -2, l.max = 6, step = 0.2, beta0 = NULL, verbose = F, max.it = 12, intercept = T, normalize = T, forwards = T) ```

## Arguments

 `x` independent variable matrix of data to be used in calculating PaC coefficient paths `y` response vector of data to be used in calculating PaC coefficient paths `C.full` complete constraint matrix C (with constraints of the form `C.full`*`beta`=`b`) `b` constraint vector b `l.min` lowest value of lambda to consider (used as 10^`l.min`). Default is -2 `l.max` largest value of lambda to consider (used as 10^`l.max`). Default is 6 `step` step size increase in lambda attempted at each iteration (by a factor of 10^`step`). Default is 0.2 `beta0` initial guess for beta coefficient vector. Default is NULL (indicating initial vector should be calculated by algorithm) `verbose` should function print output at each iteration (TRUE) or not (FALSE). Default is FALSE `max.it` maximum number of times step size is halved before the algorithm terminates and gives a warning. Default is 12 `intercept` should intercept be included in modeling (TRUE) or not (FALSE). Default is TRUE. `normalize` should `x` data be normalized. Default is TRUE `forwards` if `forwards` = F, then the algorithm starts at 10^`l.max` and moves backwards (without the forward step). If `forwards` = T, algorithm starts at 10^`l.min` and works forward. Default is FALSE

## Value

`coefs` A `p` by length(`lambda`) matrix with each column corresponding to the beta estimate for that lambda

`lambda` the grid of lambdas used to calculate the coefficients on the coefficient path

`intercept` vector with each element corresponding to intercept for corresponding lambda

`error` did the algorithm terminate due to too many iterations (TRUE or FALSE)

`b2index` the index of the `beta2` values identified by the algorithm at each lambda

## References

Gareth M. James, Courtney Paulson, and Paat Rusmevichientong (JASA, 2019) "Penalized and Constrained Optimization." (Full text available at http://www-bcf.usc.edu/~gareth/research/PAC.pdf)

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```random_data = generate.data(n = 500, p = 20, m = 10) lars_fit = lars.c(random_data\$x, random_data\$y, random_data\$C.full, random_data\$b) lars_fit\$lambda lars_fit\$error ### The coefficients for the first lambda value lars_fit\$coefs[1,] ### Example of code where path is unable ### to be finished (only one iteration) lars_err = lars.c(random_data\$x, random_data\$y, random_data\$C.full, random_data\$b, max.it = 1) lars_err\$error lars_err\$lambda ```

PACLasso documentation built on May 2, 2019, 2:29 p.m.