sim.tree: Simulate a Coalescent Tree

Description Usage Arguments Details Value Examples

View source: R/coalesceR.R

Description

Simulate a coalescent tree.

Usage

1
  sim.tree(method,sample,current,ancestral,time)

Arguments

method

simulation method: ‘hudson’ for the continuous time approximations; ‘generations’ for the generation-by-generation algorithm

sample

number of sampled lineages

current

current population size

ancestral

ancestral population size

time

time at which the population changed in size

Details

A coalescent tree is built using either the ‘hudson’'s approximation in continuous time, or a generation-by-generation algorithm. A single population is simulated, and ‘sample’ lineages are simulated. The population is assumed to have a current effective size (‘current’), and an ancestral effective size (‘ancestral’). The change in population size occurred ‘time’ generations in the past

Value

an object of class ‘coalescent’ which is a list with components:

node

the list of nodes (internal and leafs) in the tree

ancestor

the ancestor of each node

label

the label of each leaf

branch.length

the length of the branch above each node

Examples

1
2
3
4
5
## This is to simulate a coalescent tree using the Hudson's algorithm, 
## with 20 sampled lineages. In this example, the current population size
## is 100. It was 1000 before a bottleneck that occurred 50 generations ago

tree <- sim.tree(method = "hudson",sample = 20,current = 100,ancestral = 1000,time = 50)

coalesceR documentation built on May 2, 2019, 4:42 p.m.