Description Usage Arguments Value References Examples
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.
1 2 3 |
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 |
b |
constraint vector b |
l.min |
lowest value of lambda to consider (used as 10^ |
l.max |
largest value of lambda to consider (used as 10^ |
step |
step size increase in lambda attempted at each iteration (by a factor of 10^ |
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 |
forwards |
if |
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
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)
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.