title: adehabitatHS compana test returns lambda = NaN?
body: <p>I'm getting bad test results using the R package <strong>adehabitatHS</strong>, and the function <code>compana()</code>.</p>
  
  <p>The compana test compares habitat availability with habitat usage by animals. The test performs a compositional analysis, yielding a Wilk's lambda and p-value. </p>
  
  <p>I'm running the test on empirical data (16 animals, 8 habitat categories) that meets the stated format and content requirements of the compana test, but the test returns: <code>lambda = NaN, p-value = 1.0</code>.</p>
  
  <p>I've examined my data for the standard causes of NaNs, and I don't see any problems, such as missing values (<code>NA</code>s), negative proportions, or row sums > 100 percent. Moreover, the error arises when I use the full data set (16 rows, 8 columns), but not when I use a subset (missing one column). It does not seem to matter which columns are excluded, so long as only 7 or less are included.</p>
  
  <p>Details of my data are below. Any help or suggestions would be greatly appreciated. </p>
  
  <p>Platform: OSX 10.7.4 (Lion)
  R Version: R 2.15.1 GUI 1.52 Leopard build 64-bit (6188)</p>
  
  <p>R CODE:</p>
  
  <p>proportions for habitat used (matrix):</p>
  
  <pre><code>used.m
      Atr   Cre    DW  Dist  Gra   Mar   Mes   Opn
  1   2.76 19.31  4.14 17.24 0.00 28.28  0.00  0.00
  2  15.12  1.16  3.49  5.81 2.33 32.56 25.58  3.49
  3  57.35 13.24  1.47  0.00 6.62  0.00  8.09 12.50
  4  41.18  0.98  2.94  0.00 3.92  0.00 29.41 18.63
  5   9.52 17.01 23.13  0.00 0.00 37.41  3.40  0.00
  6   2.54 67.01  0.00  0.51 0.51  6.09  3.05  0.00
  7  10.45 15.67  5.22  5.97 0.00  0.00 33.58 10.45
  8   6.34  0.00  0.00  4.23 0.00  0.00  0.00 21.83
  9   0.66 18.54  1.32 39.74 0.00  8.61  2.65  0.66
  10 20.75  0.00  0.00  0.00 0.00  0.00  0.00 49.06
  11 20.14 18.06 12.50  8.33 0.00  5.56 22.22  9.72
  12  0.00  0.00  0.00 58.04 0.00  0.00 13.99  0.00
  13 44.23  4.81  0.00  0.00 0.00  0.00 28.85 19.23
  14 13.04  2.61  1.74  2.61 0.00 19.13  6.09 25.22
  15 35.96  3.51  0.00  2.63 0.00  1.75 25.44  0.88
  16  0.00  0.00  0.00 35.14 0.00  7.21  0.00  8.11
  </code></pre>
  
  <p>proportions for habitat available (matrix):</p>
  
  <pre><code>avail.m
      Atr   Cre    DW  Dist   Gra   Mar   Mes   Opn
  1   1.11 39.18 15.50  0.29  0.00 30.18  4.15  3.43
  2  18.96  1.02  0.87  7.40  4.36 37.80  6.17 10.56
  3  65.75  3.85  0.57  0.00 12.36  0.00  9.97  3.43
  4  20.52  5.44  2.01  0.00  0.08  0.00 10.99 44.22
  5  11.16 43.55 10.34  0.00  0.00 18.11  9.60  3.17
  6  25.24  9.88  2.77  2.44  4.95 12.90 11.44  2.19
  7   5.47 21.13  6.67  0.57  0.00  0.10 30.73  9.59
  8   6.23  0.00  0.00  4.85  0.00  0.00  0.00  5.72
  9   0.85  1.97  0.09 33.52  0.00  5.58  1.73  0.84
  10 18.97  0.00  0.00  0.00  0.00  0.00  0.00  5.59
  11  0.16 44.41 19.16  3.53  0.00  1.28 21.65  4.13
  12  6.67  3.89  0.31 13.63  0.00  0.00 20.56  0.00
  13 21.40  2.38  2.66  0.00  0.00  0.00 21.23 46.96
  14 42.62  9.36  1.49  3.89  0.43  3.61 20.79  5.80
  15 33.32 12.90  4.17  4.09  0.15  3.96 12.32  4.94
  16  5.65  0.00  0.00  1.36  0.00  0.59  0.00  9.71
  </code></pre>
  
  <p>load the adehabitatHS package</p>
  
  <pre><code>library(adehabitatHS)
  </code></pre>
  
  <p>run the compana test on full data set (all rows, all 8 columns)</p>
  
  <pre><code>fulldata.comp &lt;- compana(used.m, avail.m)
  </code></pre>
  
  <p>check result</p>
  
  <pre><code>fulldata.comp$test
  Lambda      P 
     NaN      1 
  </code></pre>
  
  <p>run compana on partial data (all rows, columns 1-7)</p>
  
  <pre><code>partdata.comp &lt;- compana(used.m[, 1:7], avail.m[, 1:7])
  </code></pre>
  
  <p>check result</p>
  
  <pre><code>partdata.comp$test
     Lambda         P 
   0.3319731 0.6280000 
  </code></pre>