Hi all,

Not exactly phylogenetic, but I've recently uncovered some odd behavior
with `pcoa` in `ape` and I was curious if anyone understood what was going
on.

Usually, if you don't have negative eigenvalues and aren't using a
correction, `pcoa` will return the raw eigenvalues. However, I've found if
there are negative eigenvalues and no correction is used, even though no
correction is applied, the function will still return some corrected
relative eigenvalues, and cumulative corrected eigenvalues. What correction
was used in this case is not clear.

Here's some output using an example dataset from paleotree to demonstrate
the weirdness, both without correction argument specified and with it
specified as "none".

```
> library(ape)
> library(paleotree)
>
> data(graptDisparity)
> dmat<-graptDistMat
> res<-pcoa(dmat)
> str(res)
List of 5
 $ correction: chr [1:2] "none" "1"
 $ note      : chr "No correction was applied to the negative eigenvalues"
 $ values    :'data.frame':     183 obs. of  6 variables:
  ..$ Eigenvalues   : num [1:183] 3.22 2.72 1.9 1.74 1.41 ...
  ..$ Relative_eig  : num [1:183] 0.217 0.183 0.128 0.117 0.095 ...
  ..$ Rel_corr_eig  : num [1:183] 0.0495 0.0424 0.031 0.0287 0.0241 ...
  ..$ Broken_stick  : num [1:183] 0.0319 0.0264 0.0236 0.0218 0.0204 ...
  ..$ Cum_corr_eig  : num [1:183] 0.0495 0.0919 0.1229 0.1517 0.1758 ...
  ..$ Cumul_br_stick: num [1:183] 0.0319 0.0583 0.082 0.1038 0.1242 ...
 $ vectors   : num [1:183, 1:72] 0.0143 -0.1818 -0.1011 0.104 0.101 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:183] "'Bulmanograptus' macilentus" "'Monograptus'
arciformis" "'Monograptus' austerus" "'Paramplexograptus' kiliani" ...
  .. ..$ : chr [1:72] "Axis.1" "Axis.2" "Axis.3" "Axis.4" ...
 $ trace     : num 14.8
 - attr(*, "class")= chr "pcoa"
>
> data(graptDisparity)
> dmat<-graptDistMat
> res<-pcoa(dmat,correction="none")
> str(res)
List of 5
 $ correction: chr [1:2] "none" "1"
 $ note      : chr "No correction was applied to the negative eigenvalues"
 $ values    :'data.frame':     183 obs. of  6 variables:
  ..$ Eigenvalues   : num [1:183] 3.22 2.72 1.9 1.74 1.41 ...
  ..$ Relative_eig  : num [1:183] 0.217 0.183 0.128 0.117 0.095 ...
  ..$ Rel_corr_eig  : num [1:183] 0.0495 0.0424 0.031 0.0287 0.0241 ...
  ..$ Broken_stick  : num [1:183] 0.0319 0.0264 0.0236 0.0218 0.0204 ...
  ..$ Cum_corr_eig  : num [1:183] 0.0495 0.0919 0.1229 0.1517 0.1758 ...
  ..$ Cumul_br_stick: num [1:183] 0.0319 0.0583 0.082 0.1038 0.1242 ...
 $ vectors   : num [1:183, 1:72] 0.0143 -0.1818 -0.1011 0.104 0.101 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:183] "'Bulmanograptus' macilentus" "'Monograptus'
arciformis" "'Monograptus' austerus" "'Paramplexograptus' kiliani" ...
  .. ..$ : chr [1:72] "Axis.1" "Axis.2" "Axis.3" "Axis.4" ...
 $ trace     : num 14.8
 - attr(*, "class")= chr "pcoa"
```

Obviously if there are negative eigenvalues, a correction should probably
be applied (although perhaps this is a bit of a philosophical matter), but
still its unclear why the corrected eigenvalues are calculated, or how they
are calculated. They are clearly different from the uncorrected values.

Cheers,
-Dave Bapst


-- 
David W. Bapst, PhD
Asst Research Professor, Geology & Geophysics, Texas A & M University
Postdoc, Ecology & Evolutionary Biology, Univ of Tenn Knoxville
https://github.com/dwbapst/paleotree

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to