get_summary_networks | R Documentation |
Get summary networks from posterior probabilities of interactions of extant lineages at given time points in the past
get_summary_networks(
at_ages,
threshold,
ages = NULL,
weighted = TRUE,
type = "states",
state = 2,
repertoire = "fundamental"
)
at_ages |
List of lists, with samples and posterior probabilities for each interaction of
extant lineages at given ages. Usually calculated |
threshold |
Probability threshold to include an interaction in the network. Interactions
with posterior |
ages |
Vector of ages (time points in the past) at which samples were retrieved. By default,
uses all ages present in |
weighted |
Logical. Use posterior probabilities as interaction weights? |
type |
One of |
state |
Which state? Default is 2. For analyses using the 3-state model, choose |
repertoire |
Either the |
A list of incidence matrices (summary network) for each time slice in ages
.
# read data that comes with the package
data_path <- system.file("extdata", package = "evolnets")
tree <- read_tree_from_revbayes(paste0(data_path,"/tree_pieridae.tre"))
host_tree <- ape::read.tree(paste0(data_path,"/host_tree_pieridae.phy"))
history <- read_history(paste0(data_path,"/history_thin_pieridae.txt"), burnin = 0)
# choose ages in the past
ages <- c(60, 50, 40, 0)
# calculate posterior probabilities of interactions
at_ages <- posterior_at_ages(history, ages, tree, host_tree)
# get ancestral summary networks
weighted_net_50 <- get_summary_networks(at_ages, threshold = 0.5, weighted = TRUE)
binary_net_90 <- get_summary_networks(at_ages, threshold = 0.9, weighted = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.