[R] selecting only corresponding categories from a confusion matrix
drflxms
drflxms at googlemail.com
Mon Nov 29 14:32:36 CET 2010
Dear R colleagues,
as a result of my calculations regarding the inter-observer-variability
in bronchoscopy, I get a confusion matrix like the following:
0 1 1001 1010 11
0 609 11 54 36 6
1 1 2 6 0 2
10 14 0 0 8 4
100 4 0 0 0 0
1000 23 7 12 10 5
1001 0 0 4 0 0
1010 4 0 0 3 0
1011 1 0 1 0 2
11 0 0 3 3 1
110 1 0 0 0 0
1100 2 0 0 0 0
1110 1 0 0 0 0
The first column represents the categories found among observers, the
top row represents the categories found by the reference ("goldstandard").
I am looking for a way (general algorithm) to extract a data.frame with
only the corresponding categories among observers and reference from the
above confusion matrix. "Corresponding" means in this case, that a
category has been chosen by both: observers and reference.
In this example corresponding categories would be simply all categories
that have been chosen by the reference (0,1,1001,1010,11), but generally
there might also occur categories which are found by the reference only
(and not among observers - in the first column).
So the solution-dataframe for the above example would look like:
0 1 1001 1010 11
0 609 11 54 36 6
1 1 2 6 0 2
1001 0 0 4 0 0
1010 4 0 0 3 0
11 0 0 3 3 1
All the categories found among observers only, were omitted.
If the solution algorithm would include a method to list the omitted
categories and to count their number as well as the number of omitted
cases, it would be just perfect for me.
I'd be happy to read from you soon! Thanks in advance for any kind of
help with this.
Greetings from snowy Munich, Felix
More information about the R-help
mailing list