# Analysis of multinomial logit model

I am trying to analyse some data using a multinomial logit model, and I have a few questions regarding its interpretation.

Essentially I have data from cells from four different tissues. Each cell can belong to one of three classes.

My dataset can be reproduced as such:

library(dplyr)

grp <- structure(list(Group = c("G1", "G2", "G3", "G1", "G2", "G3",
"G1", "G2", "G3", "G1", "G2", "G3"), Tissue = c("T1", "T1", "T1",
"T2", "T2", "T2", "T3", "T3", "T3", "T4", "T4", "T4"), Count = c(97L,
39L, 96L, 1829L, 378L, 881L, 47L, 55L, 14L, 74L, 78L, 40L)), row.names = c(NA,
-12L), class = "data.frame")

grp <- grp %>% uncount(Count)

> head(grp)
Group Tissue
1      G1     T1
1.1    G1     T1
1.2    G1     T1
1.3    G1     T1
1.4    G1     T1
1.5    G1     T1
> table(grp)
Tissue
Group   T1   T2   T3   T4
G1   97 1829   47   74
G2   39  378   55   78
G3   96  881   14   40


Now I perform a multinomial logit regression using nnet::multinom

library(nnet)
model <- multinom(Group ~ Tissue, grp)
zvalues <- summary(model)$coefficients / summary(model)$standard.errors
pvalues <- pnorm(abs(zvalues), lower.tail=FALSE)*2


This shows a significant effect of tissue type on the group

> pvalues
(Intercept)     TissueT2     TissueT3     TissueT4
G2 1.543861e-06 7.690904e-04 0.0001000664 0.0001125417
G3 9.426030e-01 1.505263e-06 0.0003637049 0.0129607920


I could proceed and look at the pairwise differences at each level of group and tissue, but I am wondering if there is a way of "overall" comparing different tissues.

Now, if I plot estimated marginal means using

library(emmeans)

marginals <- emmeans(model, ~ Tissue + Group)
ggplot(data.frame(marginals), aes(Group, prob, group=Tissue)) + geom_line(aes(col=Tissue))


I get Clearly, tissues T1 and T2 show similar behaviour when compared to T3 and T4, by overall belonging less to group G2

Is there a way to formally quantifying this similarity?

## 1 Answer

(If you’ve never seen ANOVA as a regression, pretty much nothing in this post will make sense, so we’ll have to discuss that.)

You’re basically doing ANOVA but with the response variable being a multinomial distribution instead of normal. In ANOVA, we compare a model that always predicts the overall mean (intercept only), and a model that that uses group membership as a predictor. If the latter model has a much better fit, then you conclude that the group membership affects the outcome. This is what the F-test does.

You have the same idea but with a different response.

ANOVA fits a mode by using square loss (least squares). Multinomial logistic regression uses maximum likelihood, so we compare the likelihoods of the two models: one that always predicts the overall proportions of each group (intercepts only) and one that also uses group indicator variables as predictors. If the model with group membership variables are predictors has much higher likelihood, we conclude that the group membership affects the response. This is quite analogous you the F-test.

This is called a likelihood ratio test. I know that VGAM has machinery for fitting multinomial logistic regression models and conducting the likelihood ratio test, though I am not sure about nnet.

• Hi Dave, yes I am aware of how GLM work, but my issue (apologies as I may have not explained it well) is that I am trying to somehow testing the distribution of counts in the different groups by tissue. So, from the plot, you can obviously see that T1 and T2 mostly belong to G1 and G3, while T3 and T4 mostly belong to G1 and G2, from which I would conclude that T1 and T2 are more similar between themselves than T3 and T4. Is this reasonable? Can I somehow test it formally? It does not need to be using a GLM, that's just what I have been trying. – nico May 21 '20 at 13:31
• How would you test it if there were just two groups and two tissues? – Dave May 21 '20 at 13:36
• I guess if I only had two tissues then it would be much easier to interpret the model coefficients. What about interpreting pairwise comparisons e.g. using pairs(marginals, by = "Tissue", type = "response"), but then, still I get tissue/group combinations. How do I get the overall effect of tissue on the group membership? Is it possible at all? – nico May 21 '20 at 13:48
• What do you mean by "overall effect of tissue on the group membership"? – Dave May 21 '20 at 20:11
• I mean that my model evaluates coefficients for all the combinations of tissue and group, by I would like to have main coefficients for tissue. So, in other words, I'd like to answer the question "is tissue 1 different from tissue 2 in the overall distribution between groups"? While at the moment I can only answer the question "is tissue 1 different from tissue 2?" for each specific group. – nico May 22 '20 at 10:26