# compute.brtime: Compute and Set Branching Times In ape: Analyses of Phylogenetics and Evolution

## Description

This function computes the branch lengths of a tree giving its branching times (aka node ages or heights).

## Usage

 `1` ```compute.brtime(phy, method = "coalescent", force.positive = NULL) ```

## Arguments

 `phy` an object of class `"phylo"`. `method` either `"coalescent"` (the default), or a numeric vector giving the branching times. `force.positive` a logical value (see details).

## Details

By default, a set of random branching times is generated from a simple coalescent, and the option `force.positive` is set to `TRUE` so that no branch length is negative.

If a numeric vector is passed to `method`, it is taken as the branching times of the nodes with respect to their numbers (i.e., the first element of `method` is the branching time of the node numbered n + 1 [= the root], the second element of the node numbered n + 2, and so on), so `force.positive` is set to `FALSE`. This may result in negative branch lengths. To avoid this, one should use `force.positive = TRUE` in which case the branching times are eventually reordered.

## Value

An object of class `"phylo"` with branch lengths and ultrametric.

Emmanuel Paradis

## See Also

`compute.brlen`, `branching.times`

## Examples

 ```1 2 3 4 5 6 7``` ```tr <- rtree(10) layout(matrix(1:4, 2)) plot(compute.brtime(tr)); axisPhylo() plot(compute.brtime(tr, force.positive = FALSE)); axisPhylo() plot(compute.brtime(tr, 1:9)); axisPhylo() # a bit nonsense plot(compute.brtime(tr, 1:9, TRUE)); axisPhylo() layout(1) ```

### Example output

```
```

ape documentation built on Nov. 17, 2017, 5:18 a.m.