# How to fit Multinomial Logistic Regression using Lasso into K-1 in R? [closed]

I have a response variable with four categories, I meant to make the first to be a reference category. I analyzed the category using Lasso in R (glmnet package). The lasso uses a more symmetric approach rather than the traditional K-1 parameterization. So at the Output will show the lasso coefficient for all four categories of my response. I wanted my Lasso analysis to show only three categories, as I mentioned earlier, I want to use the first category as reference.

This is my code for finding the coefficient of Multinomial Logistic Regression using lasso:

library(glmnet)
cvfit = cv.glmnet(X,Y,type.measure="class",alpha=1,family="multinomial")
coef(cvfit, s = "lambda.min")


My question is, how can I modify my code so that the coefficient present the K-1 parameterization as the common Multinomial Logistic Regression mode?

Any help would be appreciated. I'll be even more thank full if you add the code.

## closed as off-topic by Michael Chernick, Peter Flom♦Mar 24 '18 at 13:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Michael Chernick, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

• why do you want to do that? Something is telling me that the coefficients might not be as meaningful if they are all against the reference category. But if you really want to do that, just run 3 binary logistic regressions against your reference. – rep_ho Sep 28 '17 at 8:41
• Well my thesis use 2 methods: Common Multinomial and Lasso. In common multinomial, it used reference category. My professor want me to present both in K-1. By the way, if I used 3 binary logistics, does it mean that I must remove some of my data before analyzing? – Hafid W. Ramadhan Sep 29 '17 at 1:57
• if you just want to use multinomial logistic regression, that trains k-1 models, you can use nnet package and multinom function (i think), but that is without lasso regularization. – rep_ho Oct 2 '17 at 13:02