9.3

1.5 Plots🔗ℹ

glmnet/plot draws the two plots of R’s glmnet package: the coefficient path of a fit, as R’s plot.glmnet draws it, and the cross-validation curve, as plot.cv.glmnet draws it. It plots a glmnet-path from one of the path fitters (see Regularization paths), a glmnet-cv from one of the cross-validation procedures (see Choosing λ by cross-validation), and a formula-model of either (see Formulas and named data).

(require glmnet) does not load the plots, so a program that only fits models does not load the plot library either. They have a module of their own:

> (require glmnet/plot)

See Plots in the Reference for the plot procedures and their arguments.

Each plot is a pict, which DrRacket and this manual show as an image. The plots are drawn with plot/no-gui, whose parameters, such as plot-font-size, apply to them.

    1.5.1 Coefficient paths

      1.5.1.1 Lasso and elastic net

      1.5.1.2 The x axis

      1.5.1.3 Labels

      1.5.1.4 Several classes or responses

    1.5.2 Cross-validation curves

    1.5.3 Combining with other plots

    1.5.4 Writing to a file

    1.5.5 Matching R