1
$\begingroup$

I was going over a multinomial regression example from Faraway, "Extending the Linear Model with R Generalized Linear, Mixed Effects and Nonparametric Regression Models", book.
R script of the example is as follows:

library(faraway)

# Multinomial Logistic Regression
data(nes96)
sPID <- nes96$PID
levels(sPID) <- c("Democrat","Democrat","Independent","Independent", "Independent","Republican","Republican") 
inca <- c(1.5,4,6,8,9.5,10.5,11.5,12.5,13.5,14.5,16,18.5,21,23.5, 
          27.5,32.5,37.5,42.5,47.5,55,67.5,82.5,97.5,115) 
nincome <- inca[unclass(nes96$income)] 
library(nnet)
mmod <- multinom(sPID ~ age + educ + nincome, nes96)
summary(mmod)

The result:

## Call:
## multinom(formula = sPID ~ age + educ + nincome, data = nes96)
## 
## Coefficients:
##             (Intercept)          age     educ.L     educ.Q    educ.C
## Independent   -1.197260 0.0001534525 0.06351451 -0.1217038 0.1119542
## Republican    -1.642656 0.0081943691 1.19413345 -1.2292869 0.1544575
##                  educ^4     educ^5      educ^6    nincome
## Independent -0.07657336  0.1360851  0.15427826 0.01623911
## Republican  -0.02827297 -0.1221176 -0.03741389 0.01724679
## 
## Std. Errors:
##             (Intercept)         age    educ.L    educ.Q    educ.C
## Independent   0.3265951 0.005374592 0.4571884 0.4142859 0.3498491
## Republican    0.3312877 0.004902668 0.6502670 0.6041924 0.4866432
##                educ^4    educ^5    educ^6     nincome
## Independent 0.2883031 0.2494706 0.2171578 0.003108585
## Republican  0.3605620 0.2696036 0.2031859 0.002881745
## 
## Residual Deviance: 1968.333 
## AIC: 2004.333

While I believe I grasped the meaning of coefficients under age or income variables, I have not been able to interpret educ.L, educ.Q, educ.C, educ^4, ....

Can you help me understand this model summary?

Regards.

Edit:
Here are the things I have come up with:

  • One has to learn about contrast codings for regression. The following link explains the details. R Library: Contrast Coding Systems for categorical variables. In the model given above nes96$educ has 7 levels:
    > levels(nes96$educ) [1] "MS" "HSdrop" "HS" "Coll" "CCdeg" "BAdeg" "MAdeg"
    So contr.poly(7) or contr.poly(levels(nes96$educ)) can generate orthogonal polynomial coding contrast matrix. In fact to see this coding is used in the model above:

    > mmod$contrasts $educ [1] "contr.poly"

This tells that model mmod has a contrast coding only for predictor variable educ and the type of coding is as listed.

  • > contr.poly(levels(nes96$educ)) .L .Q .C ^4 ^5 ^6 [1,] -5.669467e-01 5.455447e-01 -4.082483e-01 0.2417469 -1.091089e-01 0.03289758 [2,] -3.779645e-01 5.900612e-17 4.082483e-01 -0.5640761 4.364358e-01 -0.19738551 [3,] -1.889822e-01 -3.273268e-01 4.082483e-01 0.0805823 -5.455447e-01 0.49346377 [4,] 3.928861e-17 -4.364358e-01 2.055987e-17 0.4834938 1.131725e-15 -0.65795169 [5,] 1.889822e-01 -3.273268e-01 -4.082483e-01 0.0805823 5.455447e-01 0.49346377 [6,] 3.779645e-01 -8.635619e-17 -4.082483e-01 -0.5640761 -4.364358e-01 -0.19738551 [7,] 5.669467e-01 5.455447e-01 4.082483e-01 0.2417469 1.091089e-01 0.03289758

The first row of the contrast matrix corresponds to "MS" category and the last row corresponds to "MAdeg" category. Each row between them corresponds to the category of `educ' accordingly. For example, for a person whose educ category is "HS" (3rd category), one should use coefficients of 3rd row of contrast matrix :

$ln\left( \frac{Pr(person = Ind)}{Pr(person = Dem)} \right) = \quad\quad\quad\quad\quad\quad\mbox{Regarding predictor:} \\ -1.19*1 \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\mbox{(Intercept)}\\ + 0.0001534525* age \quad\quad\quad\quad\quad\quad\quad\quad\quad\mbox{age}\\ + 0.06351451 * (-1.889822e-01) \quad\quad\quad\quad\mbox{educ.L}\\ + (-0.1217038) * (-3.273268e-01) \quad\quad\quad\mbox{educ.Q}\\ + 0.1119542 * (4.082483e-01) \quad\quad\quad\quad\quad\mbox{educ.C}\\ + 0.0805823 * (-0.07657336) \quad\quad\quad\quad\quad\quad\mbox{educ^4}\\ + 0.1360851 * (-5.455447e-01) \quad\quad\quad\quad\mbox{educ^5}\\ + 0.15427826 * 0.49346377 \quad\quad\quad\quad\quad\quad\quad\mbox{educ^6}\\ + 0.01623911 * nincome \quad\quad\quad\quad\quad\quad\quad\quad\mbox{nincome}$

As a result as far as I understood, for a categorical variable, columns of polynomial contrast matrix are used for the multinomial logistic regression model in nnet by default. Hence, .L, .Q, .C, ^4, etc. suffixes are used.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.