% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/phylogeny_bootstrap.R
\name{l1ou_bootstrap_support}
\alias{l1ou_bootstrap_support}
\title{Computes bootstrap support for shift positions}
\usage{
l1ou_bootstrap_support(model, nItrs = 100, multicore = FALSE, nCores = 2,
  quietly = TRUE)
}
\arguments{
\item{model}{an object output by \code{\link{estimate_shift_configuration}}.}

\item{nItrs}{number of independent iterations (bootstrap replicates).}

\item{multicore}{logical. If TRUE, nCores processes are used in parallel.}

\item{nCores}{desired number of parallel processes.}

\item{quietly}{logical. If FALSE, a summary of each iteration will be printed out.}
}
\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.
}
\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.
}
\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 \code{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.
}
\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

}
\seealso{
\code{\link{estimate_shift_configuration}}
}

