ddbd: Estimate parameter values for Birth-Death speciation prior.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/ddbd.R

Description

This function estimates the values of parameters of Birth-Death speciation tree prior for downstream Bayesian dating analysis from a branch length tree.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ddbd(
  tree.name = "",
  outgroup = "",
  sampling.frac = 0,
  anchor.node = 0,
  anchor.time = 1,
  measure = c("SSE", "KL"),
  filename = "",
  plot = TRUE
)

Arguments

tree.name

a file name of the branch length tree that is in the Newick format.

outgroup

a character list containing names of tips belonging to the rooting outgroup, which will be removed in the calculation. If outgroup = "" (the default), the input tree must be rooted and no tips will be removed.

sampling.frac

a numeric value representing the sampling fraction. If sampling.frac = 0, sampling fraction will be estimated. Otherwise, it will be fixed to the given value.

anchor.node

an ingeter corresponding to the ID of a node with user-provide node time. The user-provide value is used to convert relative rates to absolute rates. If anchor.node = 0 (the default), rates will not be converted and are still relative rates.

anchor.time

a numeric value specifying to the node time of anchor.node. When anchor.node = 0, anchor.time will be ingnored. See "details".

measure

specify the method for selecting the initial values. The best initial values can be selected by minimzing the sum of squared errors (SSE) or Kullback-Leibler divergence (KL). The default is SSE.

filename

a file name specified for the output file.

plot

logical. If TRUE (default), a histogram of node times and a density curve of the estimated parameters of Birth-Death model are plotted.

Details

Birth rate and death rate are estimated using the same time unit as provided in "anchor.time". It is recommened to adjust the time unit, so that the maximum value of "anchor time" does not exceed 10.

Value

Values of parameters in Birth-Death speciation model (<filename>_ddbd.txt). If the sampling.fraction is specified, only birth rate and death rate will be estimated. Otherwise, all three parameters will be estimated.

Author(s)

Qiqing Tao (qiqing.tao@temple.edu) and Sudhir Kumar

References

Q. Tao et al. Bioinformatics (2021) 37:i102-i110. doi:10.1093/bioinformatics/btab307

Examples

1
2
3
# Please download the "example.nwk" from https://github.com/cathyqqtao/RRF/tree/main/data.

ddbd(tree.name = "data/example.nwk", outgroup = c("Ornithorhynchus_anatinus", "Zaglossus_bruijni", "Tachyglossus_aculeatus"), anchor.node = 272, anchor.time = 1.85, measure = "SSE", filename = "data/example", plot = TRUE)

cathyqqtao/RRF documentation built on Dec. 19, 2021, 1:55 p.m.