/auteur/man/vmat.Rd

http://github.com/eastman/auteur · Unknown · 41 lines · 36 code · 5 blank · 0 comment · 0 complexity · 03a5998081dae11745fdf743ef74db60 MD5 · raw file

  1. \name{vmat}
  2. \alias{vmat}
  3. \title{computation of phylogenetic variance-covariance matrix}
  4. \description{Calculates the VCV matrix for a phylogenetic tree}
  5. \usage{vmat(phy)}
  6. \arguments{
  7. \item{phy}{a phylogenetic tree of class 'phylo'}
  8. }
  9. \details{
  10. This function is a conversion of \code{\link[ape]{vcv.phylo}} into compiled \code{C++} for rapid generation of the expected trait-variances
  11. and trait covariances among species under Brownian motion evolution. This function is highly memory intensive; for a machine with 2 Gb RAM,
  12. \code{vmat} is efficient for trees with fewer than ca. 5000 tips; for trees with 20,000 tips, sufficient memory (> 8 Gb RAM) may be required.
  13. }
  14. \value{
  15. A variance-covariance matrix for all tips within the supplied tree.
  16. }
  17. \author{JM Eastman, based on \code{\link[ape]{vcv.phylo}} by Emmanuel Paradis}
  18. \examples{
  19. ## generate tree
  20. n=250
  21. phy=rescaleTree(phy=rcoal(n=n),totalDepth=100)
  22. ## compare function times for vcv.phylo() and vmat()
  23. print(system.time(vcv.phylo(phy)))
  24. print(system.time(vmat(phy)))
  25. ## generate some smaller matrices
  26. n=4
  27. phy=rescaleTree(phy=rcoal(n=n),totalDepth=100)
  28. ## compute the variance-covariance matrix with ape and rjmcmc
  29. vcv.phylo(phy)->vAPE
  30. vmat(phy)->vRJ
  31. ## print the matrices
  32. print(vAPE)
  33. print(vRJ)
  34. ## verify that both packages return identical results
  35. print(all(vAPE==vRJ))
  36. }