| plot_glmnet {plotmo} | R Documentation | 
Plot a glmnet model
Description
Plot the coefficient paths of a glmnet model.
An enhanced version of plot.glmnet.
Usage
plot_glmnet(x = stop("no 'x' argument"),
           xvar = c("rlambda", "lambda", "norm", "dev"),
           label = 10, nresponse = NA, grid.col = NA, s = NA, ...)
Arguments
| x | The  | 
| xvar | What gets plotted along the x axis. One of: | 
| label | Default  | 
| nresponse | Which response to plot for multiple response models. | 
| grid.col | Default  | 
| s | For use by  | 
| ... | Dot arguments are passed internally to
 Use  | 
Note
Limitations
For multiple response models use the nresponse argument to
specify which response should be plotted.
(Currently each response must be plotted one by one.)
The type.coef argument of plot.glmnet is
currently not supported.
Currently xvar="norm" is not supported for multiple
response models (you will get an error message).
Interaction with plotres
When invoking this function via plotres, prefix any
argument of plotres with w1. to tell plotres to
pass the argument to this function.
For example give w1.col=1:4 to plotres (plain
col=1:4 in this context gets passed to the residual plots).
Acknowledgments
This function is based on plot.glmnet in the
glmnet package authored by Jerome Friedman,
Trevor Hastie, and Rob Tibshirani.
This function incorporates the function spread.labs from the orphaned
package TeachingDemos written by Greg Snow.
See Also
Chapter 6 in plotres vignette discusses this function.
Examples
if (require(glmnet)) {
    x <- matrix(rnorm(100 * 10), 100, 10)   # n=100 p=10
    y <- x[,1] + x[,2] + 2 * rnorm(100)     # y depends only on x[,1] and x[,2]
    mod <- glmnet(x, y)
    plot_glmnet(mod)
    # plotres(mod)                          # plot the residuals
}