4
$\begingroup$

For my understanding, multinomial logit model requires to restrict the parameters for one category to zeros. However, package{glmnet} seems to allow different parameters to every class. Could someone explain this reason?

Thank you very much in advance.

example:

#Reading packages
library(glmnet)
library(nnet)

## Testing
lasso <- glmnet(as.matrix(iris[,-5]), iris$Species, family = "multinomial") 
    lasso.cv <- cv.glmnet(as.matrix(iris[,-5]), iris$Species, family = "multinomial")

## Coef. of explanatory
lasso$a0[,which(lasso$lambda == lasso.cv$lambda.min)]
    lasso$beta$setosa[, which(lasso$lambda == lasso.cv$lambda.min)]
    lasso$beta$versicolor[, which(lasso$lambda == lasso.cv$lambda.min)]
    lasso$beta$virginica[, which(lasso$lambda == lasso.cv$lambda.min)]

### Why {glmnet} can calculate parameters of "all" category?

## comparison with result of {nnet}
nnetRes <- multinom(formula = iris$Species ~
                    iris$Sepal.Length + iris$Sepal.Width + iris$Petal.Length + 
                iris$Petal.Width, iris)
    nnetSummary <- summary(nnetRes)
    nnetSummary$coefficients

### Generally, like {nnet}, multinomial logit model can not calculate 
### parameters of a reference category.
$\endgroup$
4

0