In an ANOVA the dependent or response variable is continuous, which is not your case.
You can address the problem as a test of homogeneity between both categorical variables ("age" with 5 levels, and "car" with 3 levels). A chi-square test will quantify the deviation of the observed counts from the expected counts in each cell, based on the marginal counts.
Here is an example with made up data in R:
set.seed(0)
age = c("<25", "25 - 35", "36 -45", "46 - 55", "> 55")
car = c("American", "Japanese", "European")
d = matrix(sample(c(10:30),15), nrow = 3, byrow = T)
dimnames(d) = list(car=car, age=age)
addmargins(d)
age
car <25 25 - 35 36 -45 46 - 55 > 55 Sum
American 28 15 17 20 25 105
Japanese 13 23 24 18 30 108
European 10 12 11 29 19 81
Sum 51 50 52 67 74 294
The expected frequencies are:
round(chisq.test(d)$expected,0)
age
car <25 25 - 35 36 -45 46 - 55 > 55
American 18 18 19 24 26
Japanese 19 18 19 25 27
European 14 14 14 18 20
And the test is,
chisq.test(d)
Pearson's Chi-squared test
data: d
X-squared = 21.1005, df = 8, p-value = 0.006885
I believe you are dealing with counts, and to assess the data with an ANOVA you would probably have to turn the age
data into a continuous variable. However, and in order to preserve the ordinal information contained in the age groups, I did think of applying a Poisson generalized linear model with an ordered explanatory variable (age
):
set.seed(0)
age = c("<25", "25-35", "36-45", "46-55", "> 55")
car = c("American", "Japanese", "European")
d = matrix(sample(c(10:30),15), nrow = 3, byrow = T)
dimnames(d) = list(car=car, age=age)
addmargins(d)
require(splitstackshape)
(dat = melt(d))
car age value
1 American <25 28
2 Japanese <25 13
3 European <25 10
...
summary(glm(value ~ ordered(age) + car, dat, family = "poisson"))
Call:
glm(formula = value ~ ordered(age) + car, family = "poisson",
data = dat)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.03115 0.09805 30.915 <2e-16 ***
ordered(age).L 0.32798 0.12939 2.535 0.0113 *
ordered(age).Q 0.12096 0.13211 0.916 0.3599
ordered(age).C -0.06739 0.13146 -0.513 0.6082
ordered(age)^4 -0.06257 0.13545 -0.462 0.6441
carJapanese 0.02817 0.13705 0.206 0.8371
carEuropean -0.25951 0.14788 -1.755 0.0793 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 32.564 on 14 degrees of freedom
Residual deviance: 19.939 on 8 degrees of freedom
AIC: 105.41
Hence, the significant relationship between age
and value
(presumably the number of purchases) does seem to follow a linear relationship - linearly more cars purchased with increasing age.