% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/convergent_regions.R
\name{estimate_convergent_regimes}
\alias{estimate_convergent_regimes}
\title{Detects convergent regimes under an OU model}
\usage{
estimate_convergent_regimes(model, criterion = c("AICc", "pBIC", "BIC"),
  method = c("backward", "rr"), fixed.alpha = FALSE, nCores = 1)
}
\arguments{
\item{model}{fitted object of class l1ou returned by \code{\link{estimate_shift_configuration}}.}

\item{criterion}{information criterion for model selection (see Details in \code{\link{configuration_ic}}).}

\item{method}{search method for finding convergent regimes. ``rr'' is based on genlasso,
a regularized linear regression estimation. Currenly, this method can only accept a single trait.
The default ``backward'' method is a heuristic similar to \code{surface_backward}
in the \code{surface} package,
using backward steps to repeatedly merge similar regimes into convergent regimes.}

\item{fixed.alpha}{indicates if the alpha parameters should be optimized while phylolm optimize the likelihood function.}

\item{nCores}{number of processes to be created for parallel computing. If nCores=1 then it will run sequentially. Otherwise, it creates nCores processes by using mclapply function. For parallel computing it, requires parallel package.}
}
\description{
Takes a model previously estimated by \code{\link{estimate_shift_configuration}},
including one or more traits and a configuration of evolutionary shifts, and detect which of these regime shifts
are convergent.
}
\examples{

library(l1ou)
data("lizard.traits", "lizard.tree")
Y <- lizard.traits[, 1:1]
## first fit a model to find individual shifts (no convergence assumed):
fit_ind <- estimate_shift_configuration(lizard.tree, Y, criterion="AICc")
fit_ind
## then detect which of these shifts are convergent:
fit_conv <- estimate_convergent_regimes(fit_ind, criterion="AICc")
fit_conv
plot(fit_conv)

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

