# Interpretation of .L & .Q output from a negative binomial GLM with categorical data

I just ran a negative binomial GLM and this is the output:

Call:
glm.nb(formula = small ~ method + site + depth, data = size.dat,
init.theta = 1.080668549, link = log)

Deviance Residuals:
Min       1Q   Median       3Q      Max
-2.2452  -0.9973  -0.3028   0.3864   1.8727

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)   1.6954     0.1152  14.720  < 2e-16 ***
method.L     -0.6828     0.1637  -4.171 3.04e-05 ***
site.L        0.9952     0.2050   4.854 1.21e-06 ***
site.Q       -0.4634     0.1941  -2.387    0.017 *
depth.L       0.8951     0.1988   4.502 6.74e-06 ***
depth.Q       0.2060     0.1984   1.038    0.299
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Negative Binomial(1.0807) family taken to be 1)

Null deviance: 185.1  on 89  degrees of freedom
Residual deviance: 100.8  on 84  degrees of freedom
AIC: 518.24


My predictors are all categorical. Is this why I am getting .L and .Q. I presume they represent the different categories but does anyone know a code I could use to label them before running the GLM so that they show up as the different categories instead?

Your variables aren't just coded as factors (to make them categorical), they are coded as ordered factors. Then, by default, R fits a series of polynomial functions to the levels of the variable. The first is linear (.L), the second is quadratic (.Q), the third (if you had enough levels) would be cubic, etc. R will fit one fewer polynomial function than the number of levels in your variable. For example, if you have only two levels, only the linear trend would be fit. Moreover, the polynomial bases used are orthogonal. (For what it's worth, none of this is specific to R—or to negative binomial models—all software and types of regression models would do the same.)
my.variable <- factor(my.variable, ordered=TRUE)   # an ordered factor