bin_ml_rec {nichevol}R Documentation

Maximum likelihood reconstruction of ancestral character states

Description

Maximum likelihood reconstruction of ancestral character states

Usage

bin_ml_rec(tree_data, ...)

Arguments

tree_data

a list of two elements (phy and data) resulting from using the function treedata.

...

other arguments from ace. Arguments x, phy, type, and method are fixed.

Details

Reconstructions are done using the function ace from the ape package. The argument method is set as "ML" and the type of variable is "discrete".

Value

A table with columns representing bins, rows representing first tip states and then reconstructed nodes.

Examples

# a simple tree
data("tree5", package = "nichevol")

# a matrix of niche charactes (1 = present, 0 = absent, ? = unknown)
dataTable <- cbind("241" = rep("1", length(tree5$tip.label)),
                   "242" = rep("1", length(tree5$tip.label)),
                   "243" = c("1", "1", "0", "0", "0"),
                   "244" = c("1", "1", "0", "0", "0"),
                   "245" = c("1", "?", "0", "0", "0"))
rownames(dataTable) <- tree5$tip.label

# list with two objects (tree and character table)
treeWdata <- geiger::treedata(tree5, dataTable)

# Maximum likelihood reconstruction
ml_rec <- bin_ml_rec(treeWdata)

[Package nichevol version 0.1.20 Index]