# HowTo/Divergence Time Estimation

Many of the comparative methods require a ultrmetric tree. Currently, there are many programs available that estimate divergence times (e.g., PAUP*, paml, BEAST, r8smultidivtime). Different methods making different assumptions about how the tree may be parameterized with respect to branching times. The other available way do estimate divergence times in are is with the ape package. In each of the following examples you will need a rooted tree with branch lengths. Likewise, your tree will need to be dichotomous (i.e., with no polytomies), therefore it might need a little massaging. See the page on Tree & Data manipulation.

## How do I estimate divergence times using nonparametric rate smoothing (NPRS)

The first step is to load the functions from the ape package:

```library(ape)
```

next, you will want to read in your rooted tree with branch lengths with the 'read.tree' command:

```mytree <- read.tree(file="PATH_TO_FILE")
```

The variable 'mytree' is an object of class "phylo." This tree can be used with all of the following examples.

```chronogram(phy)
```

## How do I estimate divergence times using penalized likelihood (PL)

```library(ape)
```

```chronopl(phy, lambda, node.age = 1, node = "root", CV = FALSE)
```

This function estimates the node ages of a tree using semi-parametric method based on penalized likelihood (Sanderson 2002). The branch lengths of the input tree are interpreted as (mean) numbers of substitutions where 'phy' is an object of class "phylo"; lambda equals a value of the smoothing parameter; node.age is a numeric values specifying the fixed node ages; 'node' is the numbers of the nodes whose ages are given by node.age; "root" is a short-cut the number of the node; and 'CV'is whether to perform cross-validation.

## How do I estimate divergence times using mean path length (MPL)

```library(ape)
```

```chronoMPL(phy)
```

Credit: Most of the information on this page is paraphrased from the book Analysis of Phylogenetics and Evolution with R (Paradis, 2006) or from documentation within ape itself.