How to read ANCOVA summary tables in R

I don’t know about you, but as soon as models get slightly complex I keep forgetting how to read R’s summary tables properly. I mean, the first lines are easy, but what about the weird interacting effects? I know, it is quite embarassing.

I put an example here, pro memoria for me and for you to read it, in case you are interested.

Let’s say that we went exploring a volcanic cave in southern Iceland. Since it is late in the evening and I have a lively fantasy, let’s say that we explored the Snæfellsjökull (were Jules Verne’s “Journey to the Center of the Earth” started from). During the survey we found bacterial colonies that grow only on magnetic rocks (http://en.wikipedia.org/wiki/Magnetotactic_bacteria). We bring back two strains, Strain1 and Strain2, and we make an experiment to see how do they respond to magnetic fields of different intensity and polarity.

The experiment has:

  • A continuous magnetic gradient of 12 steps from about -1.5 to 2 units.
  • 2 bacterial strains, “Strain1” and “Strain2”.
  • Distance of the colonies from the magnetic field source: 50 and 100 mm, respectively.

Response variable: growth (or shrinkage) of the colonies in mm after 1 day.

To analyze the effect of both continuous and categorical variables on a response variable an ANCOVA is required. In R it is performed by the lm() function, which performs ANOVAs and regression analyses as well. As a colleague of mine says, “in the end they are just different names for saying ‘draw a line through your datapoints'” (which is almost true).

R apparently agrees.

 > lm1 <- lm(growth~mag*Dist*Species, data=ddd)

# ddd is the dataset were I stored my data.
# "mag" refers to the magnetic intensity gradient,
# "Dist" for the distance of the cultures
# from the source of magnetism.

> summary(lm1)

Call:
lm(formula = growth ~ mag * Dist * Species, data = ddd)

Residuals:
     Min       1Q   Median       3Q      Max
-0.75368 -0.27883 -0.03957  0.23574  1.10634

Coefficients:
                               Estimate Std. Error t value Pr(>|t|) 
(Intercept)                      0.4211     0.1548   2.721  0.00995 **
mag                             -0.6770     0.1955  -3.462  0.00100 **
Dist50mm                         0.4915     0.2189   2.246  0.03095 *
SpeciesStrain2                  -0.1236     0.2123  -0.582  0.56412 
mag:Dist50mm                    -0.3537     0.2765  -1.279  0.20910 
mag:SpeciesStrain2              -0.3590     0.2846  -1.261  0.21527 
Dist50mm:SpeciesStrain2         -0.1581     0.3002  -0.527  0.50171 
mag:Dist50mm:SpeciesStrain2      0.3569     0.4025   0.887  0.38113 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.4817 on 36 degrees of freedom
  (4 observations deleted due to missingness)
Multiple R-squared: 0.7276,    Adjusted R-squared: 0.6746
F-statistic: 13.73 on 7 and 36 DF,  p-value: 1.689e-08

Interpretation:

Our model explains ~70% of the variability (you see it from the value of the R-squared).

First line: intercept for the reference level, which R chooses automatically on an alpha-numerical basis. In this case, 0.4211 is the estimated value for species Strain1 at Dist100mm when magnetism=0. As magnetism increases, Strain1 in Dist100mm declines with slope = -0.6770 (dotted red line in the graph).

For Strain1 at Dist50mm (dotted blue line):

  • intercept = 0.4211 + 0.4915 ~ 0.91
  • slope = -0.6770 -0.3537 ~ -1

For Strain2 in Dist100mm (solid red line),

  • Intercept= 0.4211-0.1236 ~ 0.3
  • Slope= -0.6770 -0.3590 ~ -1.03

For Strain2 in Dist50mm (solid blue line),

  • Intercept= 0.4211 + 0.4915-0.1236 ~ 0.79
  • Slope= -0.6770 -0.3537 -0.3590 +0.3569 ~ -1.03

To sum up: the lower the value of the magnetic field, the better both strains grow. As the magnetic field increases, strain2 declines with a common slope ~ -1, no matter the distance from the magnetic source. Strain1 growth declines similarly to Strain2 when 50 mm away from the magnetic source. The growth of Strain2 declines significantly more when the source of magnetism is 100 mm away.

Hope this will help (at least it helped me).