[R] evaluation of 2 matrices: categorical comparison

Dylan Beaudette dylan.beaudette at gmail.com
Tue Nov 7 21:29:48 CET 2006


Greetings,

I have two matrices, read in from raster data stored in GRASS. Each matrix 
represents the output of a aggregation process on categorical data (Nomial / 
Ordinal) - derived from imagery.

I have compared these two data by the following methods:

***** pretending the data is continuous approaches (flawed i am sure...)
1. computing a difference map by computing the absolute difference 
(cell-by-cell) between the two outputs

2. simple linear regression / scatter plot of the two outputs

3. 2D histogram via. hist2d() in the gplots package


*** categorical comparisons
4. conversion of each matrix to a vector of factors and:

5. frequency tabulation for each level

6. mosiacplot 

7. computation of Cohen's Kappa (using the cohen.kappa function from 
the 'concord' package) :
# a and b are vectors with the 'factor-ized' matrices, stored as vectors
cohen.kappa(table(a,b), type='count')


A lengthy summary of this small adventure has been recorded here:
http://casoilresource.lawr.ucdavis.edu/drupal/node/275/

Please note that I am looking for a *better?* way to compare these two 
matrices. It could be that the Cohen's Kappa, and difference maps are the 
best that I am going to get.

Thanks in advance,


-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341



More information about the R-help mailing list