8.4 Analysis
Here we want to investigate the effects of species and temperature on
pulses of individual crickets. Our null hypotheses are that there is no difference in Pulse
between Species
and no change in Pulse
with increasing temperature. We conduct the test at the default \(\alpha\) = 0.05.
We use the lm()
function to fit the model, and the formula looks identical to the main-effects ANOVA and linear regression models from Chapter 4. Isn’t that handy?
Install the car
package. We need a function from this package for model summary because now we have a mix of categorical and continuous explanatory variables. This means we want to calculate the sums of squared errors a little differently than we did before.
Now we create the ANVOA table for our ANCOVA model
## Anova Table (Type III tests)
##
## Response: Pulse
## Sum Sq Df F value Pr(>F)
## (Intercept) 25.5 1 7.9906 0.008582 **
## Species 598.0 1 187.3994 6.272e-14 ***
## Temp 4376.1 1 1371.3541 < 2.2e-16 ***
## Residuals 89.3 28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
And we can look at the summary:
##
## Call:
## lm(formula = Pulse ~ Species + Temp, data = crickets)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.0128 -1.1296 -0.3912 0.9650 3.7800
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -7.21091 2.55094 -2.827 0.00858 **
## Speciesniv -10.06529 0.73526 -13.689 6.27e-14 ***
## Temp 3.60275 0.09729 37.032 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.786 on 28 degrees of freedom
## Multiple R-squared: 0.9896, Adjusted R-squared: 0.9888
## F-statistic: 1331 on 2 and 28 DF, p-value: < 2.2e-16
We see that there are significant effects of species and temperature on the pulse of individual crickets. Everything else proceeds as in the analyses Chapter 4! We can build in complexity as needed, and we can make predictions as we did before.