# Coefficient equality test for multinomial logit (preferably in R)

If I want to test the equality of the coefficients of two IVs in the same regression (same DV) I can do a Wald test. If I want to test the equality of the coefficients of the same IV in two different regressions (seemingly unrelated regressions with different DVs), I can do this kind of wizardry. But what if I need to compare the coefficients of the same IV for two different levels of a nominal variable in a multinomial logit regression? How do I test whether $\beta_1 = \beta_2$?

Let's say in:

multinom(formula = dv ~ iv, data = df)

================================================
Dependent variable:
------------------------------
dv_l1          dv_l2
(1)            (2)
------------------------------------------------
iv                    0.736***       0.658***
(0.023)        (0.021)

Constant             -5.757***      -4.396***
(0.036)        (0.018)

------------------------------------------------
Observations         245,698         245,698
Log Likelihood     -21,432.162     -21,432.162
Akaike Inf. Crit.   42,872.320      42,872.320
================================================
Note:              *p<0.05; **p<0.01; ***p<0.001


How do I test whether the difference between the coefficients for iv is statistically significant (is 0.736 - 0.658 = 0.078 significantly different from zero)?

In general you just need to extract out the coefficients, take their difference, and construct the standard error of that difference using the variance-covariance estimates of the parameters. Here is a quick example in R.

library(nnet)
library(MASS)
data(birthwt)
birthwt$race <- as.factor(birthwt$race)
m1 <- multinom(race ~ bwt, data=birthwt)

v <- vcov(m1)
c <- coef(m1)
dif <- c[1,2] - c[2,2]
se <- sqrt( v[2,2] + v[4,4] - 2*v[2,4] )
dif/se #This is standard normal distributed


The dif/se is your test statistic (this is called a Wald test), and has a standard normal distribution, so you can look up a p-value the usual way.

One package in R that helps doing these tests is the car library. Here is how you would use that package to do the same statistical test.

library(car)
linearHypothesis(m1,c("2:bwt = 3:bwt"),test="Chisq")


You will see this does a $\chi^2$ statistic, but it is the same Wald test. If you do pnorm(dif/se)*2 you will get the same p-value as the linearHypothesis function. The Wald test can be extended to testing multiple coefficient equalities, and one common one is to see if any of the coefficients change across different levels of the dependent variable.

• Thanks Andrew. Very useful and instructional. Indeed a good topic for a blog post! – retrography Aug 9 '17 at 22:34