[R] Contingency Table Analysis - specific cell to specific cell comparisons
Michael Friendly
friendly at yorku.ca
Thu Jul 22 14:50:43 CEST 2010
If you want to *see* the contributions of the cells to the association
between lang and cons, try
library(vcd)
mosaic(~lang+cons, data=langcons.table, shade=TRUE)
Tsunhin John Wong wrote:
> 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
>
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street Web: http://www.datavis.ca
Toronto, ONT M3J 1P3 CANADA
More information about the R-help
mailing list