get_ML_state_indices: Extract the indices for the ML states at each node, given a...

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

View source: R/BioGeoBEARS_simulate_v1.R

Description

Given a table with the rows representing nodes, and the columns representing the relative probabilities of each state, this function finds the ML (maximum likelihood) state(s) for each node; get_ML_state_indices does this for a row, get_ML_states iterates over all the rows.

Usage

1
2
  get_ML_state_indices(relprobs_row, nums, maxprob,
    if_ties = "takefirst")

Arguments

relprobs_row

A row from a relprobs, a numeric matrix of relative probabilities

nums

Numbers indexing the states from 1 to numstates

maxprob

The value of the maximum probability for the row.

if_ties

What to do with ties. Currently, the only option is to take the first (this will be shown in e.g. a pie chart, of course).

Value

index_of_ML_state_s

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster https://code.google.com/p/lagrange/

Matzke_2012_IBS

See Also

get_ML_states

Examples

1
testval=1

Example output

Loading required package: rexpokit
Loading required package: cladoRcpp
Loading required package: ape
Loading required package: phylobase

Attaching package: 'phylobase'

The following object is masked from 'package:ape':

    edges

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.