# What is deviance in lassoglm

I am trying to fit a lasso penalized logistic regression model to a certain data. I am using lassoglm for that in matlab. I use the following function

[B,FitInfo] = lassoglm(X,Y,'binomial','Lambda',0.01,'CV',10);

Using 10 fold cross validation, it will use different samples every time to fit the model. However, I didn't get what deviance means in this case. Lets say for the first run of cross validation, I have k non zero features. For next run, I have a model with m non zero features and so on. What does deviance then measure and how the plot is generated like using that lassoplot. Suggestion?

Actually, I didn't get this figure. What does it specify?

According to MATLAB's help, deviance is the value of the loss function for the type of model that you are using. It is the value of negative log-likelihood (MSE for linear regression) for your model averaged over the validation folds in the cross-validation procedure.

According to MATLAB's help, the two points marked in the graph are:

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).

• And what are the bars for. I mean for each point there is a bar. What is that for? – rajan sthapit Feb 10 '13 at 5:04
• MATLAB's help says: "Plots error bars for the estimates." To me they look like 1-standard deviation confidence intervals. You can see that for large values of lambda --which produces sparse models-- the variation is smaller, which confirms my guess. – Taha Feb 10 '13 at 6:42
• The bars are the standard deviation of the deviance, computed across the ten cross validation folds. – Matthew Drury Mar 12 '17 at 17:09

The green circle and dashed line locate the Lambda with minimal cross-validation error.

The blue circle and dashed line locate the point with minimal cross-validation error plus one standard deviation.