l1ou_bootstrap_support: Computes bootstrap support for shift positions

View source: R/phylogeny_bootstrap.R

l1ou_bootstrap_supportR Documentation

Computes bootstrap support for shift positions

Description

Takes a given shift configuration previously detected from data along with shift magnitudes and OU parameters, to calculate bootstrap support for shift positions. The non-parametric bootstrap procedure calculates phylogenetically-uncorrelated standardized residuals, one at each node. These residuals are sampled with replacement, then mapped back onto the tree to create bootstrap replicates. Each replicate is analyzed with the l1ou method and user-specified options.

Usage

l1ou_bootstrap_support(model, nItrs = 100, multicore = FALSE, nCores = 2,
  quietly = TRUE)

Arguments

model

an object output by estimate_shift_configuration.

nItrs

number of independent iterations (bootstrap replicates).

multicore

logical. If TRUE, nCores processes are used in parallel.

nCores

desired number of parallel processes.

quietly

logical. If FALSE, a summary of each iteration will be printed out.

Details

The results of sequential and parallel runs are not necessarily equal, because different seeds might be used for different bootstrap replicates. For multiple cores to be used, the parallel library needs to be installed. To change options for the analysis of each bootstrap replicate, like the information criterion or the maximum allowed number of shifts, modify model$opt.

Value

vector of size the number of edges in the tree. Each entry is the proportion of bootstrap replicates for which a shift is detected on the corresponding edge.

See Also

estimate_shift_configuration

Examples


data(lizard.traits, lizard.tree)
Y <- lizard.traits[,1] 
eModel <- estimate_shift_configuration(lizard.tree, Y)
result <- l1ou_bootstrap_support(eModel, nItrs=2)
# using only 2 replicates in vastly insufficient in general,
# but used here to make the illustrative example run faster.
nEdges <- Nedge(lizard.tree)
e.w <- rep(1,nEdges) 
e.w[eModel$shift.configuration] <- 3
e.l <- round(result$detection.rate*100, digits=1)
# to avoid annotating edges with support at or below 10%
e.l <- ifelse(e.l>10, paste0(e.l,"%"), NA)
plot(eModel, edge.label=e.l, edge.ann.cex=0.7, edge.label.ann=TRUE, cex=0.5, label.offset=0.02, edge.width=e.w)


Y <- lizard.traits[,1:2] 
eModel <- estimate_shift_configuration(lizard.tree, Y)
result <- l1ou_bootstrap_support(eModel, nItrs=2, multicore=TRUE, nCores=4)
result$detection.rate


khabbazian/l1ou documentation built on Aug. 10, 2022, 7:41 p.m.