# Logistic regression with coefficients penalized to other numbers

When you penalize logistic regression using l1, l2 or both penalizations, the coefficients are penalized towards 0. I would like to do the same thing but penalizing the coefficients towards other different numbers. For instance, penalize the first coefficient towards 1, the second towards 10 and the third towards -3.

Note that I am aware of this question and its answer, but it wouldn't quite work in a logistic regression scenario as substracting some combination of the predictors to the target variable doesn't give a binary variable, therefore the transformed regression is not a logistic regression anymore.

If somebody finds an R package or a way to do this with glmnet I would appreciate it a lot, thanks.

This will depend on the software used, and with R possibly with the package. But the concept that you need is that of an offset. An offset is a variable which you include in a linear predictor with a known, given constant coefficient. In R modeling functions which accepts a formula argument, it can be given as y ~ offset(x) which uses x in the linear predictor with an offset of 1. So, if you want that offset to be 3, use y ~ offset(3*x). If you want regularization against 3, you would need y ~ x + offset(3*x).
But glmnet do not accept a formula argument, but it has an extra optional argument offset which can be used likewise. So read ?glmnet. But there is a contributed package glmnetUtils which offers a formula argument, so I would use that package.