rootedTriple {MSCsimtester} | R Documentation |
Compare expected and sample frequencies of topological rooted triples.
Description
For a given species tree with population sizes, compares the expected frequencies of rooted triples to empirical frequencies in a sample of gene trees, using Chi-squared tests with 2 d.f. The exact and estimated internal branch length (in coalescent units) of the rooted triple in the species tree are also computed for comparison. A single test can be performed on the entire gene tree sample, or multiple tests on subsamples.
Usage
rootedTriple(
stree,
popSizes,
gtSample,
taxon1,
taxon2,
taxon3,
subsampleSize = FALSE
)
Arguments
stree |
An object of class |
popSizes |
An ordered list containing constant population sizes for each species tree edge, for a haploid organism.
Sizes should be doubled for diploids. If |
gtSample |
An object of class |
taxon1 |
A string specifying one taxon on |
taxon2 |
A string specifying a second taxon on |
taxon3 |
A string specifying a third taxon on |
subsampleSize |
A positive integer or |
Details
When subsampleSize
is FALSE
the Chi-squared test is performed using all
gene trees in gtSample
. Results are reported in tabular form in the console.
When subsampleSize
is positive, the N
trees in gtSample
will be partitioned into N/subsampleSize
subsamples, with a Chi-squared test
performed for each. Histograms are plotted for (1) the p-values for the Chi-squared tests on
subsamples, and (2) subsample estimates of the internal branch length for the rooted triple on the
species tree, with the true value marked.
Three distinct taxon names must be supplied, all of which must occur on stree
and in each of the gene trees in the sample.
Value
If subsampleSize
is FALSE
, returns an object of type rootedTripleOutput
which contains a table $TripletCounts
of empirical and expected rooted triple counts,
a p-value $pv
from the Chi-squared test, and a column $InternalEdge
of estimated and exact internal edge lengths.
If subsampleSize
is TRUE
, returns NULL
but produces several plots.
See Also
Examples
stree=read.tree(text="((((a:10000,b:10000):10000,c:20000):10000,d:30000):10000,e:40000);")
pops=c(15000,25000,10000,1,1,1,1,1,12000)
gts=read.tree(file=system.file("extdata","genetreeSample",package="MSCsimtester"))
rootedTriple(stree,pops,gts,"a","b","c")
rootedTriple(stree,pops,gts,"a","b","c",1000)