I'm fairly new to using R and even more so to phylogenetic regressions. But I'm attempting to run a PGLS using the package "phylolm" and appear to be hitting a problem associated with my imported phylogenetic tree.
library("phylolm") >correlation_data <- data.frame(X,Y,species,row.names="species") >model_fit <- phylolm(Y~X,data=correlation_data,phy=tree_txt, model="OUfixedRoot",boot=1000)
X and Y: ecological continuous data
species: corresponding row names for each value of X and Y
tree_txt: phylogenetic tree in plain text format, pruned to match the species names representative of each X and Y value
Whenever I attempt to run this regression, it fails to run and I receive the following error message:
Error in transf.branch.lengths(phy, model, parameters = parameters, check.pruningwise = F, : the tree is supposed to have no root edge (or of length 0).
Here is the structure of my phylogenetic tree
> str(tree_txt) List of 5 $ edge : int [1:10, 1:2] 7 8 8 9 9 7 10 10 11 11 ... $ edge.length: num [1:10] 5.12 22.03 6.82 15.21 15.21 ... $ Nnode : int 5 $ tip.label : chr [1:6] "D.maculatus" "D.blanfordii" "D.melanopogonGOM" "D.sumatranusUNIMAS" ... $ root.edge : num 75.6 - attr(*, "class")= chr "phylo" - attr(*, "order")= chr "cladewise"
Yes, I have a tiny tree (only 6 species) but checking for phylogenetic signal is not my primary reason for using this type of analysis. If I understand correctly, it seems "phylolm" doesn't like that my tree has a root edge >0
If so, why is it reporting that the first internal node, after my 6 species nodes, is 0. If this is the root location, shouldn't it also return a value >0
> tree_txt$root.edge  75.62103 > node.depth.edgelength(tree_txt)  27.146540 27.146540 27.146540 27.146540 27.146540 27.146540 0.000000 5.118179 11.934472  8.942603 26.538401
My real issue is if there's a way to remove the root.edge value, without totally changing the structure of my phylogenetic tree?
It's also worth noting I've successfully run the same analysis with the same imported tree in a gls using "ape". So I'm not sure if this issue of root.edge values is unique to "phylolm", or if it's a symptom of another underlying problem with my data.
Thanks in advance for anyone who might have some ideas on how to get my regression working again,