title: Why does the calculation of Cohen's kappa fail across different packages on this contingency table?
body: <p>I have a contingency table for which I would like to calculate Cohens's kappa - the level of agreement. I have tried using three different packages, which all seem to fail to some degree. The package <code>e1071</code> has a function specifically for a contingency table, but that too seems to fail. Below is reproducable code. You will need to install packages <code>concord</code>, <code>e1071</code>, and <code>irr</code>. </p>
  
  <pre><code># Recreate my contingency table, output with dput
  conf.mat&lt;-structure(c(810531L, 289024L, 164757L, 114316L), .Dim = c(2L, 
  2L), .Dimnames = structure(list(landsat_2000_bin = c("0", "1"
  ), MOD12_2000_binForest = c("0", "1")), .Names = c("landsat_2000_bin", 
  "MOD12_2000_binForest")), class = "table")
  
  library(concord)
  cohen.kappa(conf.mat)
  library(e1071)
  classAgreement(conf.mat, match.names=TRUE)
  library(irr)
  kappa2(conf.mat) 
  </code></pre>
  
  <p>The output I get from running this is:</p>
  
  <pre><code>&gt; cohen.kappa(conf.mat)
  Kappa test for nominally classified data
  4 categories - 2 methods
  kappa (Cohen) = 0 , Z = NaN , p = NaN 
  kappa (Siegel) = -0.333333 , Z = -0.816497 , p = 0.792892 
  kappa (2*PA-1) = -1 
  
  &gt; classAgreement(conf.mat, match.names=TRUE)
      $diag
  [1] 0.6708459
      $kappa
  [1] NA
      $rand
  [1] 0.5583764
      $crand
  [1] 0.0594124
      Warning message:
  In ni[lev] * nj[lev] : NAs produced by integer overflow
  
  &gt; kappa2(conf.mat) 
   Cohen's Kappa for 2 Raters (Weights: unweighted)
  Subjects = 2 
  Raters = 2 
  Kappa = 0 
  z = NaN 
  p-value = NaN
  </code></pre>
  
  <p>Could anyone advise on why these might fail? I have a large dataset, but as this table is simple I didn't think that could cause such problems.</p>