Documentation 
Lasso or elastic net regularization for generalized linear model regression
B = lassoglm(X,Y)
[B,FitInfo]
= lassoglm(X,Y)
[B,FitInfo]
= lassoglm(X,Y,distr)
[B,FitInfo]
= lassoglm(X,Y,distr,Name,Value)
B = lassoglm(X,Y) returns penalized maximumlikelihood fitted coefficients for a generalized linear model of the response Y to the data matrix X. Y are assumed to have a Gaussian probability distribution.
[B,FitInfo] = lassoglm(X,Y) returns a structure containing information about the fits.
[B,FitInfo] = lassoglm(X,Y,distr) fits the model using the probability distribution type for Y as specified in distr.
[B,FitInfo] = lassoglm(X,Y,distr,Name,Value) fits regularized generalized linear regressions with additional options specified by one or more Name,Value pair arguments.
X 
Numeric matrix with n rows and p columns. Each row represents one observation, and each column represents one predictor (variable). 
Y 
When distr is not 'binomial', Y is a numeric vector or categorical array of length n, where n is the number of rows of X. Y(i) is the response to row i of X. When distr is 'binomial', Y is either a:

distr 
Distributional family for the nonsystematic variation in the responses, a string. Choices:
By default, lassoglm uses the canonical link function corresponding to distr. Specify another link function using the 'link' namevalue pair. 
Specify optional commaseparated 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.
'Alpha' 
Scalar value from 0 to 1 (excluding 0) representing the weight of lasso (L^{1}) versus ridge (L^{2}) optimization. Alpha = 1 represents lasso regression, and other values represent elastic net optimization. Alpha close to 0 approaches ridge regression. See Definitions. Default: 1  
'CV' 
Method lassoglm uses to estimate deviance:
Default: 'resubstitution'  
'DFmax' 
Maximum number of nonzero coefficients in the model. lassoglm returns results for Lambda values that satisfy this criterion. Default: Inf  
'Lambda' 
Vector of nonnegative Lambda values. See Lasso.
Default: Geometric sequence of NumLambda values, the largest just sufficient to produce B = 0  
'LambdaRatio' 
Positive scalar, the ratio of the smallest to the largest Lambda value when you do not explicitly set Lambda. If you set LambdaRatio = 0, lassoglm generates a default sequence of Lambda values, and replaces the smallest one with 0. Default: 1e4  
'Link' 
Specify the mapping between the mean µ of the response and the linear predictor Xb.
 
'MCReps' 
Positive integer, the number of Monte Carlo repetitions for cross validation.
Default: 1  
'NumLambda' 
Positive integer, the number of Lambda values lassoglm uses when you do not set Lambda. lassoglm can return fewer than NumLambda fits if the deviance of the fits drops below a threshold fraction of the null deviance (deviance of the fit without any predictors X). Default: 100  
'Offset' 
Numeric vector with the same number of rows as X. lassoglm uses Offset as an additional predictor variable, but keeps its coefficient value fixed at 1.0.  
'Options' 
Structure that specifies whether to cross validate in parallel, and specifies the random stream or streams. Create the Options structure with statset. Option fields:
 
'PredictorNames' 
Cell array of strings representing names of the predictor variables, in the order in which they appear in X. Default: {}  
'RelTol' 
Convergence threshold for the coordinate descent algorithm (see Friedman, Tibshirani, and Hastie [3]). The algorithm terminates when successive estimates of the coefficient vector differ in the L^{2} norm by a relative amount less than RelTol. Default: 1e4  
'Standardize' 
Boolean value specifying whether lassoglm scales X before fitting the models. Default: true  
'Weights' 
Observation weights, a nonnegative vector of length n, where n is the number of rows of X. At least two values must be positive. Default: 1/n * ones(n,1) 
B 
Fitted coefficients, a pbyL matrix, where p is the number of predictors (columns) in X, and L is the number of Lambda values.  
FitInfo 
Structure containing information about the model fits.
If you set the CV namevalue pair to cross validate, the FitInfo structure contains additional fields.

[1] Tibshirani, R. Regression Shrinkage and Selection via the Lasso. Journal of the Royal Statistical Society, Series B, Vol. 58, No. 1, pp. 267–288, 1996.
[2] Zou, H. and T. Hastie. Regularization and Variable Selection via the Elastic Net. Journal of the Royal Statistical Society, Series B, Vol. 67, No. 2, pp. 301–320, 2005.
[3] Friedman, J., R. Tibshirani, and T. Hastie. Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of Statistical Software, Vol. 33, No. 1, 2010. http://www.jstatsoft.org/v33/i01
[4] Hastie, T., R. Tibshirani, and J. Friedman. The Elements of Statistical Learning, 2nd edition. Springer, New York, 2008.
[5] Dobson, A. J. An Introduction to Generalized Linear Models, 2nd edition. Chapman & Hall/CRC Press, New York, 2002.
[6] McCullagh, P., and J. A. Nelder. Generalized Linear Models, 2nd edition. Chapman & Hall/CRC Press, New York, 1989.
[7] Collett, D. Modelling Binary Data, 2nd edition. Chapman & Hall/CRC Press, New York, 2003.