emmanuelparadis / ape

Analysis of Phylogenetics and Evolution
https://emmanuelparadis.github.io/
GNU General Public License v2.0
53 stars 11 forks source link

Odd values in variance-covariance matrix #96

Closed kat3stewart closed 1 year ago

kat3stewart commented 1 year ago

Hello. First, this is my first time posting on a forum like this so apologies if this is the wrong platform to post about this issue (if it is, can you please suggest the correct alternative?).

My issue is this:

I would like to create a variance-covariance matrix depicting phylogenetic relatedness between tree species, as measured based on their pairwise edge distances in a phylogenetic tree. I am starting with a phylogenetic tree named pruned.tree that contains only the species that I am interested in (n=61). The class of this pruned tree in R is 'phylo'. However, when I run this piece of code:

A <- ape::vcv.phylo(pruned.tree)

it produces a variance-covariance matrix with very large values (198) along the diagonal as opposed to values of 1. While I understand that variance-covariance matrices can have values other than 1 along the diagonal, I would have expected a 1 in this case. I am unsure whether these unusual values are due to a bug or my execution of the code. Can you please provide some advice on this matter?

Please find attached a zipped folder containing (1) an R workspace with the necessary data and (2) associated code to produce the tree. Any help would be much appreciated! Thanks. phylo_tree_example.zip

emmanuelparadis commented 1 year ago

Hello, Try: A <- vcv(pruned.tree, corr = TRUE), and check ?vcv for explanations.

kat3stewart commented 1 year ago

Thank-you very much for the quick reply - your suggestion did the trick! I will follow your advice and read more about how specifying corr = TRUE changes the values. Cheers!