Learn R Programming

ape (version 5.1)

collapsed.intervals: Collapsed Coalescent Intervals

Description

This function takes a "coalescentIntervals" objects and collapses neighbouring coalescent intervals into a single combined interval so that every collapsed interval is larger than epsilon. Collapsed coalescent intervals are used, e.g., to obtain the generalized skyline plot (skyline). For epsilon = 0 no interval is collapsed.

Usage

collapsed.intervals(ci, epsilon=0)

Arguments

ci

coalescent intervals (i.e. an object of class "coalescentIntervals").

epsilon

collapsing parameter that controls the amount of smoothing (allowed range: from 0 to ci$total.depth)

Value

An object of class "collapsedIntervals" with the following entries:

lineages

A vector with the number of lineages at the start of each coalescent interval.

interval.length

A vector with the length of each coalescent interval.

collapsed.interval

A vector indicating for each coalescent interval to which collapsed interval it belongs.

interval.count

The total number of coalescent intervals.

collapsed.interval.count

The number of collapsed intervals.

total.depth

The sum of the lengths of all coalescent intervals.

epsilon

The value of the underlying smoothing parameter.

Details

Proceeding from the tips to the root of the tree each small interval is pooled with the neighboring interval closer to the root. If the neighboring interval is also small, then pooling continues until the composite interval is larger than epsilon. Note that this approach prevents the occurrence of zero-length intervals at the present. For more details see Strimmer and Pybus (2001).

References

Strimmer, K. and Pybus, O. G. (2001) Exploring the demographic history of DNA sequences using the generalized skyline plot. Molecular Biology and Evolution, 18, 2298--2305.

See Also

coalescent.intervals,skyline.

Examples

Run this code
# NOT RUN {
data("hivtree.table") # example tree
# colescent intervals from vector of interval lengths
ci <- coalescent.intervals(hivtree.table$size)
ci
# collapsed intervals
cl1 <- collapsed.intervals(ci,0)
cl2 <- collapsed.intervals(ci,0.0119)
cl1
cl2
# }

Run the code above in your browser using DataLab