Data for Exercise 8.34
VehicleA data frame/tibble with 151 observations on two variables
a factor with levels domestic and foreign
a factor with levels Much better than average,
Above average, Average, Below average, and Much worse than average
Insurance Institute for Highway Safety and the Highway Loss Data Institute, 1995.
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
T1 <- xtabs(~make + rating, data = Vehicle)
T1
#> rating
#> make Much better than average Above average Average Below average
#> Foreign 11 0 10 4
#> Domestic 30 9 38 7
#> rating
#> make Much worse than average
#> Foreign 12
#> Domestic 30
chisq.test(T1)
#> Warning: Chi-squared approximation may be incorrect
#>
#> Pearson's Chi-squared test
#>
#> data: T1
#> X-squared = 4.6026, df = 4, p-value = 0.3306
#>