My aim is to see if there exists a relation between the variables "Category" and "Types", spec. if there is a tendency for a particular category to use a particular type. These are the observed frequencies:
T1 | T2 | T3 | T4 | T5 | |
---|---|---|---|---|---|
A | 800 | 1 | 9 | 245 | 2503 |
B | 350 | 1560 | 1200 | 341 | 790 |
C | 7 | 290 | 7 | 607 | 1 |
D | 387 | 1001 | 1311 | 932 | 598 |
E | 16 | 81 | 19 | 7 | 4 |
F | 493 | 98 | 0 | 39 | 342 |
G | 32 | 318 | 2 | 1 | 3 |
H | 777 | 52 | 18 | 127 | 139 |
I | 3 | 2 | 27 | 9 | 1 |
J | 128 | 299 | 1 | 4 | 2 |
K | 10 | 5 | 2 | 4 | 76 |
L | 139 | 1 | 1 | 29 | 6 |
So I conducted a chi-square test. This is the code I used in R:
x <- matrix(c(800, 350, 7, 387, 16, 493, 32, 777,
3, 128, 10, 139, 10, 1560, 290, 1001, 81, 98,
318, 52, 4, 299, 15, 18, 19, 1200, 7, 1311,
19, 0, 2, 18, 27, 10, 2, 8, 245, 341, 607,
932, 7, 39, 10, 127, 9, 7, 8, 29, 2503, 790,
1, 598, 4, 342, 3, 139, 2, 3, 76, 6), ncol=5)
attr(x, "dimnames") <- list(Category=c("A", "B",
"C", "D", "E", "F", "G", "H", "I", "J", "K",
"L"),
Types = c("T1", "T2", "T3", "T4", "T5"))
x.test <- chisq.test(x, correct = FALSE)
x.test$expected
All the expected frequencies are > 5 and the result of the chi-square test is: X-squared = 13493, df = 44, p-value < 2.2e-16. I have also used Cramer's V to see how strong is the effect independently of the sample size (Cramer's V = 0.4543752).
I have also calculated Pearson and standardized residuals (It's not clear to me what should I use, if any) but the values are very large and I have read that this may indicate large errors, which may imply that the model can be inappropriate for the data.
These are the results of Pearson residuals:
And these are the results for standardized residuals:
Does it make any sense or would it be better to use another measure?