Function_ComputeHellingerDistances: Function_ComputeHellingerDistances: function to compute the...

Description Usage Arguments Value Examples

View source: R/Function_ComputeHellingerDistance.R

Description

This function returns a vector containing the Hellinger and KL distances between two tree models

Usage

1
Function_ComputeHellingerDistances(list.Model_01, list.Model_02)

Arguments

list.Model_01

List containing the following (1) handle.Phylogeny, (2) string.Model = "BM", "OU", "EB", "lambda", "kappa", "delta", (3) vector.Z = vector of mean (ancestral) state values, and (4) vector.Model_01_Theta = vector containing relevant parameters for the models

list.Model_02

List containing the following (1) handle.Phylogeny, (2) string.Model = "BM", "OU", "EB", "lambda", "kappa", "delta", (3) vector.Z = vector of mean (ancestral) state values, and (4) vector.Model_01_Theta = vector containing relevant parameters for the models

Value

vector.Distances Vector containing the distances computed between the two focal tree models

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
################
# Load depends #
################
library(ape)
library(geiger)
library(gaussDiff)

############################################################################################
# Specifity example tree (Fig. 8, Felsenstein 1985) used for demonstrating model distances #
############################################################################################
string.Figure01_Felsenstein1985_Tree <- "(((Species_7:1.635983031,Species_8:0.8079384444):1.801052391,(Species_6:0.4510394335,Species_5:1.208543249):0.4146682462):0.4476024657,((Species_4:0.9434278477,Species_3:0.2480806489):2.642993143,(Species_2:2.588686978,Species_1:0.908678702):0.3223280154):1.399150111):1;"
handle.Figure01_Felsenstein1985_Tree <- read.tree(text = string.Figure01_Felsenstein1985_Tree)

###################################################
# Set a vector containing parameters for Model 01 #
###################################################
vector.Model_02_Theta <- c(1, 1)
names(vector.Model_02_Theta) <- c("Sig2", "alpha")
vector.Model_01_Theta <- c(1)
names(vector.Model_01_Theta) <- c("Sig2")


list.Model01_BM <- list(handle.Phylogeny = handle.Figure01_Felsenstein1985_Tree,
                        string.Model = "BM",
                        vector.Z = rep(0, length(handle.Figure01_Felsenstein1985_Tree$tip.label)),
                        vector.Theta = vector.Model_01_Theta)

list.Model02_BM <- list(handle.Phylogeny = handle.Figure01_Felsenstein1985_Tree,
                        string.Model = "OU",
                        vector.Z = rep(0, length(handle.Figure01_Felsenstein1985_Tree$tip.label)),
                        vector.Theta = vector.Model_02_Theta)

Function_ComputeHellingerDistances(list.Model_01 = list.Model01_BM, list.Model_02 = list.Model02_BM)

radamsRHA/PRDATR documentation built on Dec. 25, 2021, 11:44 a.m.