#### /in.progress/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{
10This function is a conversion of \code{\link[ape]{vcv.phylo}} into compiled \code{C++} for rapid generation of the expected trait-variances
11and 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{
15A variance-covariance matrix for all tips within the supplied tree.
16}
18\examples{
19## generate tree
20n=250
21phy=rescaleTree(phy=rcoal(n=n),totalDepth=100)
22
23## compare function times for vcv.phylo() and vmat()
24print(system.time(vcv.phylo(phy)))
25print(system.time(vmat(phy)))
26
27## generate some smaller matrices
28n=4
29phy=rescaleTree(phy=rcoal(n=n),totalDepth=100)
30
31## compute the variance-covariance matrix with ape and rjmcmc
32vcv.phylo(phy)->vAPE
33vmat(phy)->vRJ
34
35## print the matrices
36print(vAPE)
37print(vRJ)
38
39## verify that both packages return identical results
40print(all(vAPE==vRJ))
41}