asr: Ancestral state reconstruction

View source: R/reconstruct.R

asrR Documentation

Ancestral state reconstruction

Description

Reconstruct the ancestral states of a vector or matrix object by using either parsimony or maximum-likelihood methods to infer the states at the internal nodes of a phylogenetic tree.

Usage

asr(
  var,
  tree,
  type = c("parsimony", "ML", "ace"),
  method = c("discrete", "continuous"),
  unique.cols = FALSE
)

Arguments

var

Either a matrix or a vector containing the state of a variable (eg. SNPs or a phenotype) for all individuals (ie. for all terminal nodes in the tree).

tree

A phylo object containing the tree representing the ancestral relationships between the individuals for which snps and phen are known.

type

A character string specifying whether ancestral state reconstruction should be performed by parsimony or ML (as performed by the ace function in package ape).

method

A character string specifying the type of ASR method to implement, either 'discrete' or 'continuous' (only used if type is set to "ML").

unique.cols

A logical indicating whether only unique column patterns are present in var, if var is a matrix (if so (TRUE), a time-consuming step can be skipped); by default, FALSE.

Value

Depending on the dimensions of the input var object, either a matrix or a vector containing both the known states of the variable at the terminal nodes (in positions 1:Nterminal) and the inferred states at internal nodes (in positions (Nterminal+1):Ntotal).

Author(s)

Caitlin Collins caitiecollins@gmail.com


caitiecollins/treeWAS documentation built on Feb. 11, 2025, 11:25 a.m.