Package‘lars’
March2,2012
立冬养生Type Package
Version1.1
蒸虾爬子Date2012-02-20
Title Least Angle Regression,Lasso and Forward Stagewi
Author Trevor Hastie<hastie@stanford.edu>and Brad Efron<brad@stat.stanford.edu> Maintainer Trevor Hastie<hastie@stanford.edu>
Description Efficient procedures forfitting an entire lasso quence
with the cost of a single least squaresfit.Least angle
regression and infinitessimal forward stagewi regression are
related to the lasso,as described in the paper below.
Depends R(>=2.10)
Licen GPL-2
URL www-stat.stanford.edu/~hastie/Papers/#LARS
Repository CRAN
Date/Publication2012-03-0205:04:39
练操R topics documented:
cv.lars (2)
diabetes (3)
lars (4)
plot.lars (5)
predict.lars (7)
summary.lars (8)
Index10
1
2cv.lars cv.lars Computes K-fold cross-validated error curve for lars
Description
Computes the K-fold cross-validated mean squared prediction error for lars,lasso,or forward stage-
wi.
Usage
cv.lars(x,y,K=1 ,index,
trace=FALSE,plot.it=TRUE,=TRUE,type=c("lasso","lar","forward.stagewi","stepwi"), mode=c("fraction","step"),...)
Arguments
x Input to lars
y Input to lars
K Number of folds
index Abscissa values at which CV curve should be computed.If mode="fraction"
this is the fraction of the saturated|beta|.The default value in this ca is
index=q(from= ,to=1,length=1 ).If mode="step",this is
the number of steps in lars procedure.The default is complex in this ca,and
depends on whether N>p or not.In principal it is index=1:p.Urs can supply
their own values of index(with care).
trace Show computations?
plot.it Plot it?
Include standard error bands?
type type of larsfit,with default"lasso"
mode This refers to the index that is ud for cross-validation.The default is"fraction"
for type="lasso"or type="forward.stagewi".For type="lar"or type="stepwi"
the default is"step"
...Additional arguments to lars
Value
Invisibly returns a list with components(which can be plotted using plotCVlars)
index As above
cv The CV curve at each value of index
< The standard error of the CV curve
mode As above
diabetes3
Author(s)
Trevor Hastie
References
Efron,Hastie,Johnstone and Tibshirani(2003)"Least Angle Regression"(with discussion)Annals of Statistics;e also www-stat.stanford.edu/~hastie/Papers/LARS/LeastAngle_2 2.
pdf.
Examples
data(diabetes)
attach(diabetes)
cv.lars(x2,y,trace=TRUE,max.steps=8 )
detach(diabetes)
diabetes Blood and other measurements in diabetics
Description
The diabetes data frame has442rows and3columns.The are the data ud in the Efron et al "Least Angle Regression"paper.
Format
This data frame contains the following columns:
x a matrix with10columns
y a numeric vector
x2a matrix with64columns
奢香墓
Details
The x matrix has been standardized to have unit L2norm in each column and zero mean.The matrix x2consists of x plus certain interactions.
英雄联盟玩法
Source
www-stat.stanford.edu/~hastie/Papers/LARS/LeastAngle_2 2.ps
References
Efron,Hastie,Johnstone and Tibshirani(2003)"Least Angle Regression"(with discussion)Annals of Statistics
4lars lars Fits Least Angle Regression,Lasso and Infinitesimal Forward Stage-
wi regression models
Description
The are all variants of Lasso,and provide the entire quence of coefficients andfits,starting from
zero,to the least squaresfit.
Usage
lars(x,y,type=c("lasso","lar","forward.stagewi","stepwi"),
trace=FALSE,normalize=TRUE,intercept=TRUE,Gram,eps=.Machine$double.eps,max.steps,u.Gra Arguments
x matrix of predictors
y respon
世界环境日是哪一天type One of"lasso","lar","forward.stagewi"or"stepwi".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 L2norm,otherwi it is left
alone.Default is TRUE.
intercept if TRUE,an intercept is included in the model(and not penalized),otherwi no
intercept is included.Default is TRUE.
Gram The X’X matrix;uful for repeated runs(bootstrap)where a large X’X stays
the same.
eps An effective zero
华南农业大学面积max.steps Limit the number of steps taken;the default is8*min(m,n-intercept),
with m the number of variables,and n the number of samples.For type="lar"
or type="stepwi",the maximum number of steps is min(m,n-intercept).
For type="lasso"and especially type="forward.stagewi",there can be
many more terms,becau although no more than min(m,n-intercept)vari-
ables can be active during any step,variables are frequently droppped and added
as the algorithm proceeds.Although the default usually guarantees that the al-
gorithm has proceeded to the saturatedfit,urs should check.
u.Gram When the number m of variables is very larger than N,then you may
not want LARS to precompute the Gram matrix.Default is u.Gram=TRUE
Details
冰糖葫芦学习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 squaresfit.A"stepwi"option has recently
been added to LARS.
plot.lars5
Value
A"lars"object is returned,for which print,plot,predict,coef and summary methods exist.
Author(s)
Brad Efron and Trevor Hastie
References
Efron,Hastie,Johnstone and Tibshirani(2003)"Least Angle Regression"(with discussion)Annals
of Statistics;e also www-stat.stanford.edu/~hastie/Papers/LARS/LeastAngle_2 2.
pdf.Hastie,Tibshirani and Friedman(2002)Elements of Statistical Learning,Springer,NY.
See Also
print,plot,summary and predict methods for lars,and cv.lars
Examples
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 u abbreviations
plot(object3)
detach(diabetes)
plot.lars Plot method for lars objects
Description
Produce a plot of a larsfit.The default is a complete coefficient path.
Usage
##S3method for class’lars’
plot(x,xvar=c("norm","df","arc.length","step"),breaks=TRUE,plottype=c("coefficients", "Cp"),s=TRUE,eps=1e-1 ,...)