Hi Debora,
When you use lassoglm in MATLAB , the intercept (bias/constant) is handled automatically; you do not set it manually.The coefficients for predictors are returned in the output B.The intercept is returned separately in FitInfo.Intercept.By default, lassoglm always fits an intercept unless you specify 'Intercept',false.
Example:
% Fit a Poisson GLM with Lasso regularization and a fixed lambda
[B, FitInfo] = lassoglm(dX, y, 'poisson', 'Lambda', 0.001);
% B contains the coefficients for your predictors (excluding the intercept)
% FitInfo.Intercept contains the intercept (bias/constant) term
% To get the full set of coefficients including the intercept:
fullBeta = [FitInfo.Intercept; B];
% To make predictions on new data (dXnew):
yhat = glmval([FitInfo.Intercept; B], dXnew, FitInfo.Link);
Following are the documentation links that you can refer to :
