# Interpreting coefficient in GLM with categorical explanatory variables

I'm performing a GLM, the response variable is number of individuals, and response variables are

1. habitat (4 levels) and

2. season (4 levels).

I need some help since I know the summary() shows p-values but not for the first (alphabetical) level of factor. I mean, I don't know how to interpret that the Intercept has a significant p-value. I can't reach a biological explanation for this model. Hope you can help me ...

    Call:
glm(formula = individuals ~ habitat + season, family =
data = data)

Deviance Residuals:
Min        1Q    Median        3Q       Max
-2.85859  -0.51541  -0.08508   0.36497   2.29058

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)            1.6774     0.1624  10.331  < 2e-16 ***
habitatDeciduous       0.1340     0.1696   0.790  0.42950
habitatSemiDeciduous   0.2102     0.1675   1.255  0.20933
habitatWetland        -0.1861     0.2039  -0.912  0.36151
seasondry2018         -0.1138     0.1510  -0.753  0.45123
seasonwet2016         -0.2699     0.1576  -1.713  0.08677 .
seasonwet2017         -0.4383     0.1656  -2.647  0.00813 **

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 78.487  on 63  degrees of freedom
Residual deviance: 64.556  on 57  degrees of freedom
AIC: 287.77

• Can you clarify in your response the names of all of your habitat categories and all of your season categories? Commented Sep 18, 2018 at 1:29
• I don't think that's really necessary to the question. Commented Sep 18, 2018 at 9:09
• @Ingolifs: How can you fully interpret the intercept of a model if you don't know what the reference categories are for the factors included in the model? Having said that, if you feel that information is not necessary, you can go ahead and provide the desired interpretation. Prior to answering, I find it fair to ask for the information I think it is necessary for me to provide a helpful and specific answer. Commented Sep 22, 2018 at 19:55

When independent variables are categorical, one level of each is chosen as a refernce level. By default, R choose the first one in alphabetical order. The other levels are compared to that level.

The intercept is the parameter estimate for when all the other variables are 0 -- in this case, when the other two variables are at the reference level.

You can change the defaults, but R questions are off-topic here.

Do not overcomplicate things. In regression models with categorical variables (factors in R speak), when dummy (one-hot) encoding is used: You want to do contrasts between parameters, but this includes the level of the factor that was "left out". The left-out level has an implied estimate value of 0 --- zero. As that is implicit in the parametrization and not estimated, its implied standard error is zero.

Yes, it would be nice if the software output included this ...

Also, whichever categorical encoding scheme you are using, you can get inference for parameter contrasts of interest by formulating it as a linear hypothesis. In R you could use car::linearHypothesis function.

I would quite like to know the proper answer to this too.

In the meantime, you can use the relevel() function. Pick one of the 'non-default' factors, perhaps the ones with the least significance (habitatDeciduous and seasondry2018) and make them the default factor, by typing in something like:

    data$habitat <- relevel(data$habitat, "Deciduous")


and rerunning the glm. You'll get different numbers out of the new model and the two models aren't really comparable with each other, but you will be able to get an idea of how significant the 'missing' factor is.