[R-sig-eco] Minimum Number of Observations for pcaCoDa?

Rich Shepard rshepard at appl-ecosys.com
Thu Nov 20 23:08:44 CET 2014


   The compositional data sets have few observations: 4 to 7 rows each, but
there are 5 parts (columns) for each row.

   I tried to use the robCompositions function pcaCoDa(). There was an error
and warning generated:

( winters.biplot <- pcaCoDa(winters.coda) )
Error in princomp.default(xilr, covmat = cv, cor = FALSE) :
   covariance matrix is not non-negative definite
In addition: Warning message:
In covMcd(xilr, cor = FALSE) :
   n < 2 * p, i.e., possibly too small sample size

   The matrix for winters.code has the counts:

   filter gather graze predate shred
1      3     27     3      11     1
2      3     28     3      13     2
3      3     43     7      15     1
4      4     54     6      24     3
5      3     26     4      22     5
6      1     39     2      18     2

   Same results with the data file winters.acomp:

          filter    gather      graze   predate      shred
[1,] 0.06666667 0.6000000 0.06666667 0.2444444 0.02222222
[2,] 0.06122449 0.5714286 0.06122449 0.2653061 0.04081633
[3,] 0.04347826 0.6231884 0.10144928 0.2173913 0.01449275
[4,] 0.04395604 0.5934066 0.06593407 0.2637363 0.03296703
[5,] 0.05000000 0.4333333 0.06666667 0.3666667 0.08333333
[6,] 0.01612903 0.6290323 0.03225806 0.2903226 0.03225806
attr(,"class")
[1] "acomp"

   Is there a minimum number of observations for PCA or was I using the
incorrect data format?

Rich



More information about the R-sig-ecology mailing list