ax = lassoPlot(B) creates
a trace plot of the values in B against the L^{1} norm
of B. ax is a handle to the
plot axis.

ax = lassoPlot(B,FitInfo) creates
a plot with type depending on the data type of FitInfo and
the value, if any, of the plotType name-value
pair.

ax = lassoPlot(B,FitInfo,Name,Value) creates
a plot with additional options specified by one or more Name,Value pair
arguments.

[ax,figh]
= lassoPlot(B,...) returns a handle
to the figure window.

Input Arguments

B

Coefficients of a sequence of regression fits, as returned from
the lasso or lassoglm functions. B is
a p-by-NLambda matrix, where p is
the number of predictors, and each column of B is
a set of coefficients lasso calculates using
one Lambda penalty value.

FitInfo

Information controlling the plot:

FitInfo is a structure, especially
as returned from lasso or lassoglm — lassoPlot creates
a plot based on the PlotType name-value pair.

FitInfo is a vector — lassoPlot forms
the x-axis of the plot from the values in FitInfo.
The length of FitInfo must equal the number of
columns of B.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments.
Name is the argument
name and Value is the corresponding
value. Name must appear
inside single quotes (' ').
You can specify several name and value pair
arguments in any order as Name1,Value1,...,NameN,ValueN.

'Parent'

Axis in which to draw the plot.

Default: New plot

'PlotType'

Choose the plot type when you give a FitInfo vector
or structure:

FitInfo Type

PlotType

Plot

Vector or Structure

'L1'

plotLasso creates the x-axis
from the L^{1} norm of
the coefficients in B. The x-axis
at the top of the plot contains the degrees of freedom (df),
meaning the number of nonzero coefficients of B.

Structure

'Lambda'

plotLasso creates the x-axis
from the Lambda field of FitInfo.
The x-axis at the top of the plot contains the degrees of freedom
(df), meaning the number of nonzero coefficients
of B.

Cross-Validated Structure

'CV'

For each Lambda, plots an estimate
of the mean squared prediction error on new data for the model fitted
by lasso with that value of Lambda.

Plots error bars for the estimates.

Plots the value of Lambda with
minimum cross-validated MSE.

Plots the greatest Lambda that
is within one standard error of minimum MSE (so makes the sparsest
model within that region).

Default: 'L1'

'PredictorNames'

Cell array of strings to label each coefficient of B.
If the length of PredictorNames is less than the
number of rows of B, the remaining labels are padded
with default values.

lassoPlot uses the predictor names in FitInfo only
if:

You created FitInfo with a call
to lasso that included a PredictorNames name-value
pair.

You call lassoPlotwithout a PredictorNames name-value
pair.

You include FitInfo in your lassoPlot call.

Default: {'B1','B2',...}

'XScale'

'linear' for linear x-axis

'log' for logarithmic scaled x-axis

Default: 'linear', except 'log' for
the 'CV' plot type