fitch.mvsl | R Documentation |

Implements an unordered Fitch parsimony reconstruction of discrete niche variables
for use in the OU models where optima are modeled on discrete, categorical niche encodings.
Allows for delayed and accelerated transformations to deal with ambiguities.
Function was originally the `fitch()`

function from the slouch package.

```
fitch.mvsl(phyltree, niche, deltran = FALSE, acctran = FALSE, root = NULL)
```

`phyltree` |
The phylogenetic tree in ape ( |

`niche` |
The specific niche variable in the slouch data.frame to be
reconstructed, entered as data.frame |

`deltran` |
Implements a delayed transformation algorithm in order to deal with ambiguous nodes |

`acctran` |
Implements an accelerated transformation algorithm to deal with ambiguous nodes |

`root` |
An optional argument allowing the user to define a character state for the root (useful if the root node is ambiguously reconstructed) |

The `fitch.mvsl`

function is meant to be interactive, where the user acts on the advice
given in the returned messages whilst attempting to reconstruct ancestral states.
If the root node is ambiguous after an initial reconstruction (a message will be printed to
the screen if this is the case), this needs to be set by the user using the `root = "state"`

argument in the function call. Any remaining ambiguous nodes can then be dealt with by specifying
`deltran`

or `acctran ="TRUE"`

in the function call

The `fitch.mvsl`

function returns a list with two or three elements. The first,
`$branch_regimes`

is a vector of reconstructed character states. Each entry of
the vector corresponds to the respective edge in the `$edge`

field in the provided tree.
Notice that entries correspond to edges and not to nodes. If you require correspondence
with nodes, then you can treat the given edge entry as the value for the node ending the edge.
Actually, this is what the algorithm in the function estimates.
The second field of the output object, `$root_regime`

s is the regime at the root of the tree.
If the provided tree was a raw `phylo`

object, then the function will also return
an enhanced version of it (field `$phyltree`

). This is the tree that results from calling
mvSLOUCH`::phyltree_paths(phyltree)`

on the originally provided tree. This
enhanced version is returns as calculating it is costly and the user might want to re-use
it in some downstream analysis with mvSLOUCH. All mvSLOUCH user-level functions
first enhance the provided phylogeny by mvSLOUCH`::phyltree_paths()`

, but they
first check if it is not already enhanced.

Jason Pienaar jasonpienaar@gmail.com

Fitch, M.W. (1971) Defining the course of Evolution: Minimum change for a specific tree topology.
*Systematic Zoology* **20**:406–416.

Swofford, D. L. and W.P. Maddison (1987) Reconstructing ancestral character states under
Wagner parsimony. *Mathematical Biosciences* **87**: 199–229.

`slouch::fitch`

, `slouch::slouchtree.plot`

, `slouch::model.fit`

,
`slouch::ouch2slouch`

```
RNGversion(min(as.character(getRversion()),"3.6.1"))
set.seed(12345, kind = "Mersenne-Twister", normal.kind = "Inversion")
phyltree<-ape::rtree(5)
regimes<-c("A","B","B","C","C")
regimesFitch<-fitch.mvsl(phyltree,regimes,root=1,deltran=TRUE)
RNGversion(as.character(getRversion()))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.