[R] Contingency Table Analysis - specific cell to specific cell comparisons

Tsunhin John Wong thjwong at gmail.com
Wed Jul 21 14:07:47 CEST 2010


Dear R users,

I have a question of how to do some specific cell to cell comparisons
on a R x C contingency table.
The table is a 3 x 5 table with frequency / count data.

> langcons.table <- table(lang, cons)
> langcons.table[cbind(lang,cons)] <- freq
> langcons.table

  Adj Int Oth Pas Tra
C  69 221  17   3 198
E  56 214  33  31 174
J  36 291   8   9 164

I know how to do an independent model test using Poisson in glm
> glm.out1 <- glm(freq~lang+cons, family=poisson, data=langcons.data)
> summary(glm.out1)

And then fit the saturated model
> glm.out2 <- glm(freq~lang*cons, family=poisson, data=langcons.data)
> summary(glm.out2)

However, the results are difficult to interpret:
C and Adj are used to as a baseline.
And I can only see main effects and interactions and *always according
to the baseline*.
Coefficients:
                         Estimate Std. Error z value Pr(>|z|)
(Intercept)
lang1
lang2
cons1
cons2
cons3
cons4
lang1:cons1
lang2:cons1
lang1:cons2
lang2:cons2
lang1:cons3
lang2:cons3
lang1:cons4
lang2:cons4

If anyone know, please suggest me some way to do specific cell to cell
comparison on such a contingency table.
Say, to compare pairs of cells:
along a column: 3 vs 31, 9 vs 31, 3 vs 9
along a row: 36 vs 9
or even across column and row: 36 vs 31, and 36 vs 3

Thanks for your help in advance.

Best,

John



More information about the R-help mailing list