regimeMaker: Paint ouch-style regimes over a set of trees based on a...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/regimes.R

Description

This function utilizes a matrix of the format returned by regimeMatrix to define the models it is going to create. Then, it paints these models onto the trees provided and returns a list suitable for further analysis.

Usage

1
regimeMaker(ouchTrees, regMatrix, nodeMembers)

Arguments

ouchTrees

A list of ouch-style trees

regMatrix

A model by nodes matrix of the format returned by regimeMatrix

nodeMembers

A list of individuals defining the nodes specified in regMatrix

Details

The easiest way to use this function will usually be to utilize regimeMatrix to create the matrix input as regMatrix and manually prune or add rows. See the example below.

Value

A list with three items:

regList

A list of lists of regimes, with the number of first-order items corresponding to the number of trees in ouchTrees, the number of second-order items corresponding to the number of models being tested. In the example below, regs$regList[[2]][[4]] is the fourth model defined on the second tree.

nodeMatrix

A boolean matrix with rows corresponding to the trees in ouchTrees and columns corresponding to the nodes specified in regMatrix; cells indicate by TRUE or FALSE whether a node is present in each of the trees being analyzed.

regMatrix

A list of regimeMatrix-format matrices that define the models applicable for each tree in ouchTrees, with missing nodes designated by 0s and duplicate rows blanked out with NA.

Note

Use of regimeMatrix or regimeMaker to generate tailored sets of regimes is not currently integrated smoothly with runBatchHansen, but for the time being they can be used to create regimes for manual analysis.

Author(s)

Andrew L. Hipp <ahipp@mortonarb.org>

See Also

regimeMatrix, paintBranches

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  data(carex)
  # tree comes in in phylo format, but we need an ouchtree object
  trees <- lapply(carex$ovales.bayesTrees[1:10], ape2ouch) 
  # if we are interested in comparing the single-change models that allow changes only at nodes 
  # 1, 2, 4, 5, and 8, as well as the no-change model, we could do:
  mat <- regimeMatrix(n = 8, maxNodes = 1)[c(1,2,4,5,8,9), ] # the 9th row is the no-change model
  #... then we make regimes based on that regime matrix...
  regs <- regimeMaker(trees, mat, carex$ovales.nodes)
  #... and paint the regimes from tree 1 onto tree 1 either singly...
  plot(trees[[1]], regime = regs$regList[[1]][[1]])
  #... or in a layout:
  plot(trees[[1]], regime = regs$regList[[1]])

Example output

Loading required package: ouch
Loading required package: subplex
Loading required package: ape

maticce documentation built on May 2, 2019, 6:13 p.m.