glmnet
is a widely-used R package for generalized linear regression. Among the arguments passed to the main function glmnet::glmnet()
, the standardize
controls whether the feature matrix is standardized before fitting, and the intercept
determines whether an intercept is included in the linear model.
The thing is, glmnet
allows the model to standardize the feature and fit with no intercept at the same time, which is confusing to me. Suppose that there is a feature $X$ standardized as $\tilde{X}=\frac{X-\mu}{\sigma}$, and $\tilde\beta$ is the estimated coefficient in front of $\tilde X$. When we recover the coefficient $\beta = \tilde\beta/\sigma$ for the unstandardized feature, a constant $-\tilde\beta\mu/\sigma$ is pulled out and added to the intercept. As a side result, an intercept is almost inevitable.
As the core algorithm of glmnet
is written in Fortran, it is hard for me myself to look into its implementation.