Data for Exercise 10.53
Nascar
A data frame/tibble with 36 observations on six variables
duration of pit stop (in seconds)
a numeric vector representing team 1, 2, or 3
a numeric vector ranking each pit stop in order of speed
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
boxplot(time ~ team, data = Nascar, col = rainbow(3))
model <- lm(time ~ factor(team), data = Nascar)
summary(model)
#>
#> Call:
#> lm(formula = time ~ factor(team), data = Nascar)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -13.000 -3.375 0.125 3.938 12.000
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 23.000 1.834 12.544 4.18e-14 ***
#> factor(team)2 3.500 2.593 1.350 0.186
#> factor(team)3 11.750 2.593 4.531 7.28e-05 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Residual standard error: 6.351 on 33 degrees of freedom
#> Multiple R-squared: 0.3962, Adjusted R-squared: 0.3596
#> F-statistic: 10.83 on 2 and 33 DF, p-value: 0.0002426
#>
anova(model)
#> Analysis of Variance Table
#>
#> Response: time
#> Df Sum Sq Mean Sq F value Pr(>F)
#> factor(team) 2 873.5 436.75 10.826 0.0002426 ***
#> Residuals 33 1331.2 40.34
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
rm(model)