Using inverseA with a phylo object

I am using the package mcmcglmm and trying to calculate the inverse of the summed matrix of phylogenetic correlation (which will feed into a MCMCglmm). I have a phylogenetic tree 'tree' and initially ran the following:

inv.phylo <- inverseA(pedigree=tree, nodes="ALL", scale=TRUE, reduced = FALSE)

This threw up errors relating to the format of my phlogenetic tree, so I then made the tree ultrametric and rooted the tree (as requested) using the code:

tree.UM <- chronos(tree)
tree.root <- root(tree.UM, "Ovibos_moschatus", resolve.root=TRUE)

Now when I run:

inverseA(pedigree=tree.root, nodes="ALL", scale=TRUE, reduced = FALSE)

I get the error:

Error in pedigree[, 2] : incorrect number of dimensions

I've noted that tree.root has one more edge and node than tree, but cannot work out if this is 1) causing the problem, or 2) what to do about it if it is? So far I've tried running chronos() and root() the other way round, and using chronoMPL() instead of chronos(). Everything I have read indicates that inverseA() should work on a phylo object, which is what tree.root is, so I cannot afthom why it does not like it? Can anyone help me to get inverseA() to run?

Thanks in advance :slight_smile:

See the FAQ: How to do a minimal reproducible example reprex for beginners. Unless someone has encountered the identical or closely similar problem, it's very difficult to pose an answer in the abstract. Even finding the MCMCglmm package requires some effort for those willing to read the documentation to see what arguments the function expects. (Package names are case-sensitive.)

All I can suggest is to compare the tree object to the exemplary data and confirm that the lengths of $edge and $edge.length are identical.

data(bird.families)
#> Warning in data(bird.families): data set 'bird.families' not found
str(bird.families)
#> Error in str(bird.families): object 'bird.families' not found

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.