I have a data frame with two categorical variables (representing different methods) that "classify" objects into three categories: cat1
, cat2
, cat3
. The objects are classified somewhat differently by the two variables and I would like to perform a test described as "Measuring Agreement Between Observers" in Agresti's CDA, Section 10.5 (after Thompson 2009, p. 192) to check if both methods perform differently.
Wanting to follow the example in package exactLoglinTest, I struggle to create a cross-classification data frame similar to library(exactLoglinTest); data(pathologist.dat)
My variables are in the following form:
classification.1 classification.2
cat1 cat1
cat1 cat2
cat3 cat3
cat2 cat2
cat2 cat3
…etc
I have more than thousand classified observations and (as far as I understand) I would like to count all the combinations – i.e. cat1
& cat1
, cat1
& cat2
, cat1
& cat3
, etc.
How can I achieve this?
References: Thompson, L.A. 2009. R (and S-PLUS) Manual to Accompany Agresti’s Categorical Data Analysis (2002) 2nd edition. available online
Best Answer
Gives you something like: