estimate_edge_KDE {ontophylo}R Documentation

Estimate the normalized Markov KDE

Description

Estimated the normalized Markov KDE for each edge averaged across all possible root-tip paths.

Usage

estimate_edge_KDE(tree.discr, Path.data, h)

Arguments

tree.discr

simmap or phylo object. A discretized tree using the 'discr_Simmap' function.

Path.data

numeric. A list of path data obtained from the 'make_data_NHPP_KDE_Markov_kernel' function.

h

numeric. A value for the bandwidth calculated using the 'estimate_band_W' function.

Value

A list with the estimated unnormalized ($Maps.mean) and normalized ($Maps.mean.norm) KDEs for each edge.

Author(s)

Sergei Tarasov

Examples

data("hym_nhpp", "hym_tree")
# Get reference tree.
tree_discr <- discr_Simmap(hym_tree, res = 200)
# Make NHPP path data.
nhpp <- hym_nhpp$head
# Add pseudo data to path data.
psd <- lapply(nhpp, function(x) -x[x < 100] )
edge_groups <- as.list(1:length(hym_tree$edge.length))
nhpp_psd <- add_pseudodata(Edge.groups = edge_groups, Pseudo.data = psd, Path.data = nhpp)
# Calculate bandwidth.
bdw <- estimate_band_W(tree_discr, nhpp_psd, band.width = "bw.nrd0")
bdw <- mean(bdw)
# Estimate non-normalized and normalized edge KDE.
Edge_KDE <- estimate_edge_KDE(tree_discr, nhpp_psd, h = bdw)
# Check KDE data for normalized mean rates from an arbitrary branch.
Edge_KDE$Maps.mean.norm[[5]]
# Check KDE data for non-normalized mean rates from an arbitrary branch.
Edge_KDE$Maps.mean[[5]]


[Package ontophylo version 1.1.3 Index]