I'm very new to R and get some trouble to interpret. Here is the code

Crabs <- read.table("http://www.stat.ufl.edu/~aa/cat/data/Crabs.dat", 
                      header = TRUE)
fit <- glm(y ~ width + factor(color), family = binomial, data = Crabs)

And the output is

glm(formula = y ~ width + factor(color), family = binomial, data = Crabs)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.1124  -0.9848   0.5243   0.8513   2.1413  

                Estimate Std. Error z value Pr(>|z|)    
(Intercept)    -11.38519    2.87346  -3.962 7.43e-05 ***
width            0.46796    0.10554   4.434 9.26e-06 ***
factor(color)2   0.07242    0.73989   0.098    0.922    
factor(color)3  -0.22380    0.77708  -0.288    0.773    
factor(color)4  -1.32992    0.85252  -1.560    0.119    
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.46  on 168  degrees of freedom
AIC: 197.46

Number of Fisher Scoring iterations: 4

Q1: In sector 'Coefficients:' there is no 'factor(color)1' but others. Why?

Q2: What's the difference between 'Null deviance' and 'Residual deviance'

Q3: What does 'AIC' mean?

Could I please have some help? Short answer is fine

  • 1
    $\begingroup$ AIC is short for Akaike information criterion (Google is your friend). Null/residual deviance are explained in many different places (again, Google is your friend). Color 1 is the reference category, the estimates for color 2/3/4 are in relation to this category. $\endgroup$
    – Edgar
    Jun 1, 2021 at 12:46
  • 1
    $\begingroup$ Related: Interpretation of R's output for binomial regression $\endgroup$ Jun 1, 2021 at 15:25
  • $\begingroup$ Absolutely no offense to the poster but this is what happens when you don't have a degree in Mathematics and trying to mess around with the global "machine learning" and "data science" trend. $\endgroup$ Jun 2, 2021 at 12:49

2 Answers 2


Your questions are already answered in several threads on the site, so I'll provide links to detailed explanations:


Q1: In sector 'Coefficients:' there is no 'factor(color)1' but others. Why?

Because it is included in the intercept. It's similar to a situation where you have a continuous variable - the intercept is the expected value when the variable is zero. With categorical variables we call the level which is included in the intercept the "reference level" and the estimates for the other levels are the expected difference in the response between the reference level and the estimated level

Q2: What's the difference between 'Null deviance' and 'Residual deviance'

Null deviance relates to a model with no explanatory variables whereas the residual deviance is for the model that you fitted.

Q3: What does 'AIC' mean?

AIC stands for Akaike Information Criterion. It is a measure of goodness of fit.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.