Converts a tree from Newick or matching to moment format
Converts a tree from Newick or matching to moment format
toMoment(inputobject, tip.label =NULL)
Arguments
inputobject: a tree in Newick format or a matching object defined in the ape package
tip.label: rearranged labels for tips; these must be the original labels
Details
The L-matrix class consists of 5 components: "L" is the L-matrix in square form. "L.ut" is the L-matrix in upper-triangular form. "Newick" is the Newick representation of the tree. "tip.label" is the character vector of tip labels. "tip.label.n" is the number of tips.
Returns
a moment L-matrix corresponding to the input phylogentic tree object
References
K Phillips, Symbolic Computation of the Central Moments of the Multivariate Normal Distribution, Journal of Statistical Software, 2010.
# create a Newick objectexam.Newick <-"(((a,b),c),d);"# convert to a moment L-matrixexam.moment <- toMoment(exam.Newick)# convert to matching objectexam.matching <- toMatching(exam.moment)# convert back to moment objectbackto.moment <- toMoment(exam.matching)