Learn R Programming

BioGeoBEARS (version 0.2.1)

get_ML_state_indices: Extract the indices for the ML states at each node, given a row of relative probabilities

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

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

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

Run this code
testval=1

Run the code above in your browser using DataLab