# plot.lars: Plot method for lars objects In lars: Least Angle Regression, Lasso and Forward Stagewise

 plot.lars R Documentation

## Plot method for lars objects

### Description

Produce a plot of a lars fit. The default is a complete coefficient path.

### Usage

```## S3 method for class 'lars'
plot(x, xvar= c("norm", "df", "arc.length", "step"), breaks = TRUE,
plottype = c("coefficients", "Cp"), omit.zeros = TRUE, eps = 1e-10, ...)
```

### Arguments

 `x` lars object `xvar` The type of x variable against which to plot. `xvar=norm` (default) plots against the L1 norm of the coefficient vector, as a fraction of the maximal L1 norm. `xvar=step` plots against the step number (which is essentially degrees of freedom for LAR; not for LASSO or Forward Stagewise). `xvar=arc.length` plots against the arc.length of the fitted vector; this is useful for a LAR object, because the L1 norm of its coefficient vector need not be monotone in the steps. `xvar=df` plots against the estimated df, which is the size of the active set at each step. `breaks` If `TRUE`, then vertical lines are drawn at each break point in the piecewise linear coefficient paths `plottype` Either `coefficients` (default) or `Cp`. The coefficient plot shows the path of each coefficient as a function of the norm fraction or Df. The Cp plot shows the Cp curve. `omit.zeros` When the number of variables is much greater than the number of observations, many coefficients will never be nonzero; this logical (default `TRUE`) avoids plotting these zero coefficents `eps` Definition of zero above, default is `1e-10` `...` Additonal arguments for generic plot. Can be used to set xlims, change colors, line widths, etc

### Details

The default plot uses the fraction of L1 norm as the xvar. For forward stagewise and LAR, coefficients can pass through zero during a step, which causes a change of slope of L1 norm vs arc-length. Since the coefficients are piecewise linear in arc-length between each step, this causes a change in slope of the coefficients.

NULL

Trevor Hastie

### References

Efron, Hastie, Johnstone and Tibshirani (2003) "Least Angle Regression" (with discussion) Annals of Statistics; see also https://hastie.su.domains/Papers/LARS/LeastAngle_2002.pdf. Yann-Ael Le Borgne (private communication) pointed out the problems in plotting forward stagewise and LAR coefficients against L1 norm, and the solution we have implemented.

### Examples

```data(diabetes)
attach(diabetes)
object <- lars(x,y)
plot(object)
detach(diabetes)
```

lars documentation built on April 14, 2022, 1:06 a.m.