I have the following multinomial logit regression
FLAG ~ Cash + Debt + Other variables
Where FLAG is a dummy with three levels, that distinguishes three different types of firms, while Cash and Debt are some variables regarding those firms.
The results of the regression are the following
Variables Type 0 vs Type 1 Type 0 vs Type 2
Cash 0.543*** 0.321***
Debt -0.124*** 0.452***
I now want to test whether the difference between these coefficients is statistically significant (in this case, between 0.543 and 0.321, and between -0.124 and 0.452)
I know I have to use the Wald test (as it was used in some papers I looked at, that performed the same analysis), but I don't know how to implement it on R.
What's the R code to implement a Wald test of the difference between the coefficients of the model?
Here's an example using the
Chiledata from thecarDatapackage.Let's say that in the model above, you wanted to compare the coefficients for
sexMfor the categoriesNandU. You could save the variance-covariance matrix of the estimators invand the coefficients themselves in a vector calledb.Then, you could create the relevant z-statistic by dividing the difference in coefficients by its standard error (the square root of the sum of the two variances minus two times the covariance of the relevant parameters):
Then, you could use
pnorm()to calculate the p-value.Another option would be to just change the reference category. For example if I wanted the
U-Ncomparison, I could change the reference to eitherUorNand re-estimate the model:Note that the two p-values are very close (though not exactly the same) as are the differences in the coefficients from the two methods, which are not printed.
I wrote a package called
factorplotwhich will calculate all of the pairwise differences for a single variable's coefficients in the MNL model:Created on 2022-09-29 by the reprex package (v2.0.1)
This method is a bit easier and is based on the same calculations I proposed in the first method above.