lars | R Documentation |
These are all variants of Lasso, and provide the entire sequence of coefficients and fits, starting from zero, to the least squares fit.
lars(x, y, type = c("lasso", "lar", "forward.stagewise", "stepwise"), trace = FALSE, normalize = TRUE, intercept = TRUE, Gram, eps = 1e-12, max.steps, use.Gram = TRUE)
x |
matrix of predictors |
y |
response |
type |
One of "lasso", "lar", "forward.stagewise" or "stepwise". The names can be abbreviated to any unique substring. Default is "lasso". |
trace |
If TRUE, lars prints out its progress |
normalize |
If TRUE, each variable is standardized to have unit L2 norm, otherwise it is left alone. Default is TRUE. |
intercept |
if TRUE, an intercept is included in the model (and not penalized), otherwise no intercept is included. Default is TRUE. |
Gram |
The X'X matrix; useful for repeated runs (bootstrap) where a large X'X stays the same. |
eps |
An effective zero, with default |
max.steps |
Limit the number of steps taken; the default is |
use.Gram |
When the number m of variables is very large, i.e. larger than N, then
you may not want LARS to precompute the Gram matrix. Default is
|
LARS is described in detail in Efron, Hastie, Johnstone and Tibshirani (2002). With the "lasso" option, it computes the complete lasso solution simultaneously for ALL values of the shrinkage parameter in the same computational cost as a least squares fit. A "stepwise" option has recently been added to LARS.
A "lars" object is returned, for which print, plot, predict, coef and summary methods exist.
Brad Efron and Trevor Hastie
Efron, Hastie, Johnstone and Tibshirani (2003) "Least Angle Regression" (with discussion) Annals of Statistics doi: 10.1214/009053604000000067; see also https://hastie.su.domains/Papers/LARS/LeastAngle_2002.pdf. Hastie, Tibshirani and Friedman (2002) Elements of Statistical Learning, Springer, NY.
print, plot, summary and predict methods for lars, and cv.lars
data(diabetes) par(mfrow=c(2,2)) attach(diabetes) object <- lars(x,y) plot(object) object2 <- lars(x,y,type="lar") plot(object2) object3 <- lars(x,y,type="for") # Can use abbreviations plot(object3) detach(diabetes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.