Generalized linear models

web.stanford.edu/class/stats305b

Jonathan Taylor

Winter 2022

Generalized linear models (Ch. 4)

One parameter exponential families

\[ \begin{aligned} \nabla \Lambda(\alpha) &= E_{\alpha}[Y] \\ \nabla^2 \Lambda(\alpha) &= \text{Var}_{\alpha}[Y] \end{aligned} \]

where \(E_{\alpha}\) is distribution with density

\[y \mapsto \exp(\alpha \cdot y) b(y) \]

Poisson case

“Unnatural models”

Generalized linear models

Given a dataset \((Y_i, X_{i1}, \dots, X_{ip}), 1 \leq i \leq n\) we consider a model for the distribution of \(Y|X_1, \dots, X_p\).

Binary regression as GLM

The \(\text{logit}\) transform is the canonical link. This is our “natural” binary regression model because the natural parameters are modelled as \(X\beta\).

library(glmbb) # for `crabs` data
data(crabs)
width_logit = glm(y ~ width, family=binomial(), data=crabs)
width_probit = glm(y ~ width, family=binomial(link='probit'), data=crabs)
c(AIC(width_logit), AIC(width_probit))
## [1] 198.4527 198.0357
summary(width_probit)
## 
## Call:
## glm(formula = y ~ width, family = binomial(link = "probit"), 
##     data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0519  -1.0494   0.5374   0.9126   1.6897  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -7.50196    1.50712  -4.978 6.44e-07 ***
## width        0.30202    0.05804   5.204 1.95e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 225.76  on 172  degrees of freedom
## Residual deviance: 194.04  on 171  degrees of freedom
## AIC: 198.04
## 
## Number of Fisher Scoring iterations: 5

Deviance for binary glm

\[ \begin{aligned} \text{DEV}(\beta|Y) &= -2 \log L(\pi(\beta)|Y) + 2 \log L(Y|Y) \\ &= 2 \sum_{i=1}^n -Y_i \log \left(\frac{F(X_i^T\beta)}{1 - F(X_i^T\beta)}\right) - \log(1 - F(X_i^T\beta)) \end{aligned} \]

Gradient for binary glm

\[ \begin{aligned} \nabla \text{DEV}(\beta|Y) &= 2 \sum_{i=1}^n X_i \cdot f(X_i^T\beta) \biggl[\frac{-Y_i} {F(X_i^T\beta)(1 - F(X_i^T\beta))} + \\ & \qquad \qquad \qquad \frac{1}{1 - F(X_i^T\beta)} \biggr] \\ &= 2 \sum_{i=1}^n X_i \cdot f(X_i^T\beta) \left[\frac{F(X_i^T\beta)-Y_i} {F(X_i^T\beta)(1 - F(X_i^T\beta))} \right] \\ &= 2 \sum_{i=1}^n X_i \cdot \frac{f(X_i^T\beta)^2}{F(X_i^T\beta)(1 - F(X_i^T\beta))} \left[\frac{F(X_i^T\beta)-Y_i}{f(X_i^T\beta)} \right] \end{aligned} \]

Hessian for binary glm

\[ \begin{aligned} E_{\beta} [ \nabla^2 \text{DEV}(\beta|Y)] &= 2 \cdot \text{Var}_{\beta}[\nabla \text{DEV}(\beta|Y)] \\ &= 2 \sum_{i=1}^n X_iX_i^T \frac{f(X_i^T\beta)^2}{F(X_i^T\beta)(1 - F(X_i^T\beta))} \\ &= 2 \cdot X^TW_{\beta}X \end{aligned} \]

where

\[ W_{\beta} = \text{diag}\left(\frac{f(X_i^T\beta)^2}{F(X_i^T\beta)(1-F(X_i^T\beta))}\right) \]

Fisher scoring

\[ \begin{aligned} \hat{\beta}^{(k+1)} &= \hat{\beta}^{(k)} - E_{\hat{\beta}^{(k)}}[\nabla^2 \text{DEV}(\hat{\beta}^{(k)}|Y)]^{-1} \nabla \text{DEV}(\hat{\beta}^{(k)}|Y) \\ &= (X^TW^{(k)}X)^{-1}X^TW^{(k)}\left(X \hat{\beta}^{(k)} + \frac{Y - F(X\hat{\beta}^{(k)})}{f(X\hat{\beta}^{(k)})} \right) \end{aligned} \]

Fisher scoring and IRLS

\[ \begin{aligned} Z^{(k+1)} &= X\hat{\beta}^{(k)} + \frac{Y - F(X\hat\beta^{(k)})}{f(X\hat\beta^{(k)})} \\ W^{(k+1)} &= W_{\hat{\beta}^{(k)}} \\ &= \frac{f(X\hat{\beta}^{(k)})^2}{F(X\hat{\beta}^{(k)})(1 - F(X\hat{\beta}^{(k)}))}. \end{aligned} \]

Fisher scoring and IRLS

\[ g \left(E_{\hat{\beta}^{(k)}}(Y) \right) + g'\left(E_{\hat{\beta}^{(k)}}(Y)\right) \cdot \left(Y - E_{\hat{\beta}^{(k)}}(Y) \right) \]

or,

\[ g(\hat{\mu}^{(k)}) + g'(\hat{\mu}^{(k)})(Y - \hat{\mu}^{(k)}) \]

with

\[ \hat{\mu}^{(k)} = E_{\hat{\beta}^{(k)}}(Y) \]

\[ W^{(k)} = \text{Var}_{\hat{\beta}^{(k)}}(g'(\mu)(Y-\mu)). \]

Asymptotic distribution

\[ \hat{\beta} \approx N\left(\beta^*, (X^TW_{\hat{\beta}}X)^{-1} \right) \]

where covariance matrix is a consistent estimator and we apply Slutsky.

\[ 0 = E_G\left[X \frac{f(X^T\beta^*(G))}{F(X^T\beta^*(G))(1-F(X^T\beta^*(G)))} \left(Y - F(X^T\beta^*(G))\right) \right] \]

Inference

anova(width_probit, glm(y ~ width + color, 
          family=binomial(link="probit"), 
          data=crabs))
## Analysis of Deviance Table
## 
## Model 1: y ~ width
## Model 2: y ~ width + color
##   Resid. Df Resid. Dev Df Deviance
## 1       171     194.04            
## 2       168     187.31  3   6.7272
1 - pchisq(6.72, 3)
## [1] 0.08137855
summary(glm(y  ~ width + color, 
            family=binomial(link="probit"), 
            data=crabs))
## 
## Call:
## glm(formula = y ~ width + color, family = binomial(link = "probit"), 
##     data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1348  -1.0009   0.5143   0.8662   2.1544  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -6.94034    1.54818  -4.483 7.36e-06 ***
## width        0.28031    0.06011   4.664 3.11e-06 ***
## colordarker -0.65847    0.35357  -1.862   0.0626 .  
## colorlight   0.11098    0.45860   0.242   0.8088    
## colormedium  0.16335    0.25087   0.651   0.5150    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 225.76  on 172  degrees of freedom
## Residual deviance: 187.31  on 168  degrees of freedom
## AIC: 197.31
## 
## Number of Fisher Scoring iterations: 5

Poisson data (4.3)

\[ \begin{aligned} P_{\lambda}(Y=y) &= \frac{\lambda^y}{y!} e^{-\lambda} \\ &= \exp(y \cdot \log \lambda) \frac{e^{-\lambda}}{y!} \end{aligned} \]

Generalized linear models for counts

\[ \log\left(\lambda_i\right) = X_i^T\beta \]

with

\[ \lambda_i = E[Y_i|X_i]. \]

Interpretation of coefficients

\[\frac{E_{\beta}(Y|\dots, X_j=x_j+1, \dots)}{E_{\beta}(Y|\dots, X_j=x_j, \dots)} = e^{\beta_j} \]

Likelihood for log-linear models

\[ \begin{aligned} \nabla DEV(\beta|Y) &= 2 X^T(\exp(X\beta) - Y ) \\ &= 2 X^T(E_{\beta}(Y) - Y) \\ \nabla^2 DEV(\beta|Y) &= 2 X^T\exp(X\beta)X \\ &= 2 X^T \text{Var}_{\beta}(Y)X \end{aligned} \]

library(glmbb) # for `crabs` data
data(crabs)
satell_log = glm(satell ~ width + color, family=poisson(), data=crabs)
summary(satell_log)
## 
## Call:
## glm(formula = satell ~ width + color, family = poisson(), data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0415  -1.9581  -0.5575   0.9830   4.7523  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.08640    0.55750  -5.536 3.09e-08 ***
## width        0.14934    0.02084   7.166 7.73e-13 ***
## colordarker -0.01100    0.18041  -0.061   0.9514    
## colorlight   0.43636    0.17636   2.474   0.0133 *  
## colormedium  0.23668    0.11815   2.003   0.0452 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 632.79  on 172  degrees of freedom
## Residual deviance: 559.34  on 168  degrees of freedom
## AIC: 924.64
## 
## Number of Fisher Scoring iterations: 6
par(mfrow=c(2,2))
plot(satell_log)

Newton-Raphson for log-linear models

\[ \begin{aligned} W^{(k+1)} &= \exp(X\hat\beta^{(k)}) \\ Z^{(k+1)} &= X\hat{\beta}^{(k)} + (Y - \exp(X\hat\beta^{(k)}))/ \exp(X\hat\beta^{(k)}) \\ &= g(E_{\hat{\beta}^{(k)}}(Y)) + g'(E_{\hat{\beta}^{(k)}}(Y)) \cdot (Y - E_{\hat{\beta}^{(k)}}(Y)) \\ &= g(\hat{\mu}^{(k)}) + g'(\hat{\mu}^{(k)})(Y - \hat{\mu}^{(k)}) \end{aligned} \]

“Unnatural models”

\[ g(\lambda_i) = X_i^T\beta \]

or,

\[ \lambda_i = g^{-1}(X_i^T\beta) \]

\[ DEV(\beta|Y) = 2 \sum_{i=1}^n \left[g^{-1}(X_i^T\beta) - Y_i \log(g^{-1}(X_i^T\beta)) - Y_i + Y_i \log(Y_i) \right] \]

satell_inverse = glm(satell ~ width + color, 
                     family=poisson(link='inverse'), 
                     data=crabs)
summary(satell_inverse)
## 
## Call:
## glm(formula = satell ~ width + color, family = poisson(link = "inverse"), 
##     data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.8701  -2.0606  -0.4481   1.0042   4.6942  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  1.259804   0.136929   9.200  < 2e-16 ***
## width       -0.031806   0.004905  -6.484 8.92e-11 ***
## colordarker  0.011778   0.077006   0.153   0.8784    
## colorlight  -0.126441   0.055752  -2.268   0.0233 *  
## colormedium -0.085615   0.045740  -1.872   0.0612 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 632.79  on 172  degrees of freedom
## Residual deviance: 574.53  on 168  degrees of freedom
## AIC: 939.82
## 
## Number of Fisher Scoring iterations: 8

“Unnatural models”

\[ \begin{aligned} \nabla DEV(\beta|Y) &= 2 X^T\left(\frac{1 - \frac{Y}{g^{-1}(X\beta)}}{g'(g^{-1}(X\beta))}\right) \\ &= 2 X^T\left(\frac{1 - \frac{Y}{E_{\beta}(Y)}}{g'(E_{\beta}(Y))}\right) \\ E_{\beta}\left[\nabla^2 DEV(\beta|Y) \right] &= 2 X^T\left(\frac{1}{g'(E_{\beta}(Y))^2 E_{\beta}(Y)}\right)X \\ &= 2 X^TW_{\beta}X \end{aligned} \]

with

\[ W_{\beta} = \text{diag}(1 / (\lambda_i g'(\lambda_i)^2)), \qquad \lambda_i = g^{-1}(X_i^T\beta) \]

“Unnatural models”

\[ \begin{aligned} W^{(k+1)} &= W_{\hat{\beta}^{(k)}} \\ Z^{(k+1)} &= \hat{\eta}^{(k)} + g'(\hat{\mu}^{(k)})(Y - E_{\hat{\beta}^{(k)}}(Y)) \end{aligned} \]

with

\[ \hat{\eta}^{(k)} = X\hat{\beta}^{(k)} = g(\hat{\mu}^{(k)}). \]

Distribution of \(\hat{\beta}\)

X = model.matrix(satell_log)
W = fitted(satell_log)
solve(t(X) %*% (W * X))
##              (Intercept)         width   colordarker    colorlight
## (Intercept)  0.310805970 -0.0114263483 -0.0162473663  0.0019301044
## width       -0.011426348  0.0004343334  0.0002297147 -0.0004612394
## colordarker -0.016247366  0.0002297147  0.0325477977  0.0099601366
## colorlight   0.001930104 -0.0004612394  0.0099601366  0.0311020571
## colormedium  0.002771373 -0.0004932173  0.0099432238  0.0107278527
##               colormedium
## (Intercept)  0.0027713727
## width       -0.0004932173
## colordarker  0.0099432238
## colorlight   0.0107278527
## colormedium  0.0139590542
vcov(satell_log)
##              (Intercept)         width   colordarker    colorlight
## (Intercept)  0.310805898 -0.0114263456 -0.0162473648  0.0019301016
## width       -0.011426346  0.0004343333  0.0002297147 -0.0004612393
## colordarker -0.016247365  0.0002297147  0.0325477151  0.0099601366
## colorlight   0.001930102 -0.0004612393  0.0099601366  0.0311020569
## colormedium  0.002771369 -0.0004932172  0.0099432238  0.0107278525
##               colormedium
## (Intercept)  0.0027713695
## width       -0.0004932172
## colordarker  0.0099432238
## colorlight   0.0107278525
## colormedium  0.0139590539
X = model.matrix(satell_inverse)
W = fitted(satell_inverse)^3
solve(t(X) %*% (W * X))
##               (Intercept)         width   colordarker    colorlight
## (Intercept)  0.0187471088 -6.400857e-04 -2.108431e-03 -7.723414e-04
## width       -0.0006400857  2.405665e-05  1.474627e-05 -3.546863e-05
## colordarker -0.0021084309  1.474627e-05  5.933203e-03  1.694329e-03
## colorlight  -0.0007723414 -3.546863e-05  1.694329e-03  3.108126e-03
## colormedium -0.0001139935 -6.021163e-05  1.679162e-03  1.804845e-03
##               colormedium
## (Intercept) -1.139935e-04
## width       -6.021163e-05
## colordarker  1.679162e-03
## colorlight   1.804845e-03
## colormedium  2.092418e-03
vcov(satell_inverse)
##               (Intercept)         width   colordarker    colorlight
## (Intercept)  0.0187494465 -6.401830e-04 -0.0021081258 -0.0007720202
## width       -0.0006401830  2.406026e-05  0.0000147454 -0.0000354700
## colordarker -0.0021081258  1.474540e-05  0.0059298789  0.0016940499
## colorlight  -0.0007720202 -3.547000e-05  0.0016940499  0.0031082448
## colormedium -0.0001136107 -6.021527e-05  0.0016788847  0.0018045581
##               colormedium
## (Intercept) -1.136107e-04
## width       -6.021527e-05
## colordarker  1.678885e-03
## colorlight   1.804558e-03
## colormedium  2.092165e-03

Distribution of \(\hat{\beta}\)

Overdispersion

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
crabs$groups = cut(crabs$width, breaks=c(0, seq(23.25, 29.25, by=1), max(crabs$width)))
results = crabs %>%
          group_by(groups) %>%
          summarize(N=n(), numS = mean(satell), varS = var(satell))
## `summarise()` ungrouping output (override with `.groups` argument)
results
## # A tibble: 8 x 4
##   groups          N  numS  varS
##   <fct>       <int> <dbl> <dbl>
## 1 (0,23.2]       14  1     2.77
## 2 (23.2,24.2]    14  1.43  8.88
## 3 (24.2,25.2]    28  2.39  6.54
## 4 (25.2,26.2]    39  2.69 11.4 
## 5 (26.2,27.2]    22  2.86  6.89
## 6 (27.2,28.2]    24  3.88  8.81
## 7 (28.2,29.2]    18  3.94 16.9 
## 8 (29.2,33.5]    14  5.14  8.29

Quasilikelihood

\[ V_{Q}(\mu) = \phi \cdot V(\mu) \]

yields exactly the same fitted value whatever \(\phi\) we use.

Quasilikelihood

Estimate of dispersion

\[ \hat{\phi} = \frac{1}{n-p} \sum_{i=1}^n \frac{(Y_i - \hat{\mu}_i)^2 }{V(\hat{\mu}_i)} = \frac{1}{n-p} X^2(M) \]

\[ \hat{\beta}-\beta^* \approx N(0, \hat{\phi} \cdot (X^TW^{(\infty)}X)^{-1}) \]

summary(glm(satell ~ width + color, family=quasipoisson(), data=crabs))
## 
## Call:
## glm(formula = satell ~ width + color, family = quasipoisson(), 
##     data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0415  -1.9581  -0.5575   0.9830   4.7523  
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.08640    1.00251  -3.079  0.00243 ** 
## width        0.14934    0.03748   3.985  0.00010 ***
## colordarker -0.01100    0.32442  -0.034  0.97300    
## colorlight   0.43636    0.31713   1.376  0.17066    
## colormedium  0.23668    0.21246   1.114  0.26687    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasipoisson family taken to be 3.233628)
## 
##     Null deviance: 632.79  on 172  degrees of freedom
## Residual deviance: 559.34  on 168  degrees of freedom
## AIC: NA
## 
## Number of Fisher Scoring iterations: 6
c(0.037 / 0.020, sqrt(3.23))
## [1] 1.85000 1.79722
summary(satell_log, dispersion=3.228764)
## 
## Call:
## glm(formula = satell ~ width + color, family = poisson(), data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0415  -1.9581  -0.5575   0.9830   4.7523  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.08640    1.00176  -3.081  0.00206 ** 
## width        0.14934    0.03745   3.988 6.66e-05 ***
## colordarker -0.01100    0.32417  -0.034  0.97294    
## colorlight   0.43636    0.31689   1.377  0.16851    
## colormedium  0.23668    0.21230   1.115  0.26492    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 3.228764)
## 
##     Null deviance: 632.79  on 172  degrees of freedom
## Residual deviance: 559.34  on 168  degrees of freedom
## AIC: 924.64
## 
## Number of Fisher Scoring iterations: 6
summary(satell_log)
## 
## Call:
## glm(formula = satell ~ width + color, family = poisson(), data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0415  -1.9581  -0.5575   0.9830   4.7523  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.08640    0.55750  -5.536 3.09e-08 ***
## width        0.14934    0.02084   7.166 7.73e-13 ***
## colordarker -0.01100    0.18041  -0.061   0.9514    
## colorlight   0.43636    0.17636   2.474   0.0133 *  
## colormedium  0.23668    0.11815   2.003   0.0452 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 632.79  on 172  degrees of freedom
## Residual deviance: 559.34  on 168  degrees of freedom
## AIC: 924.64
## 
## Number of Fisher Scoring iterations: 6

Negative binomial (4.3.4)

\[ Y \sim \text{Negative binomial}(\mu,k) \]

where

\[ P(Y=y) = \frac{\Gamma(y+k)}{\Gamma(k) \Gamma(y+1)} \left(\frac{k}{\mu+k} \right)^k \left(1 - \frac{k}{\mu+k} \right)^y, \qquad y=0,1,2,\dots \]

Negative binomial

\[ \begin{aligned} E[Y] &= \mu \\ \text{Var}(Y) &= \mu + \mu^2 / k \end{aligned} \]

so that it is a GLM for \(k\) fixed.

library(MASS)
## 
## Attaching package: 'MASS'
## The following object is masked _by_ '.GlobalEnv':
## 
##     crabs
## The following object is masked from 'package:dplyr':
## 
##     select
satell_nb = MASS::glm.nb(satell ~ width + color, data=crabs)
summary(satell_nb)
## 
## Call:
## MASS::glm.nb(formula = satell ~ width + color, data = crabs, 
##     init.theta = 0.9320986132, link = log)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8714  -1.3769  -0.2663   0.4410   2.2496  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.87271    1.19047  -3.253  0.00114 ** 
## width        0.17839    0.04529   3.939 8.18e-05 ***
## colordarker -0.01570    0.33125  -0.047  0.96220    
## colorlight   0.52033    0.38396   1.355  0.17536    
## colormedium  0.24440    0.22864   1.069  0.28510    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(0.9321) family taken to be 1)
## 
##     Null deviance: 216.56  on 172  degrees of freedom
## Residual deviance: 196.23  on 168  degrees of freedom
## AIC: 760.6
## 
## Number of Fisher Scoring iterations: 1
## 
## 
##               Theta:  0.932 
##           Std. Err.:  0.168 
## 
##  2 x log-likelihood:  -748.596
# Standard errors have changed, estimates are similar
summary(satell_log)
## 
## Call:
## glm(formula = satell ~ width + color, family = poisson(), data = crabs)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -3.0415  -1.9581  -0.5575   0.9830   4.7523  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.08640    0.55750  -5.536 3.09e-08 ***
## width        0.14934    0.02084   7.166 7.73e-13 ***
## colordarker -0.01100    0.18041  -0.061   0.9514    
## colorlight   0.43636    0.17636   2.474   0.0133 *  
## colormedium  0.23668    0.11815   2.003   0.0452 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 632.79  on 172  degrees of freedom
## Residual deviance: 559.34  on 168  degrees of freedom
## AIC: 924.64
## 
## Number of Fisher Scoring iterations: 6