% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/runELA.R
\name{Stability}
\alias{Stability}
\title{stability}
\usage{
Stability(
  sa,
  ocmat,
  enmat = NULL,
  seitr = 1000,
  seconvTime = 10000,
  threads = 1,
  reporting = TRUE
)
}
\arguments{
\item{sa}{: output of runSA function.}

\item{ocmat}{: array of the vectors of presence/absence status for each sample.}

\item{enmat}{: array of the vectors of environmental factors for each sample. Normalization required.}

\item{seitr}{: Number of stochastic search iterations.}

\item{seconvTime}{: Maximum number of iterations for each search.}

\item{threads}{: number of cores (threads) used for calculation.}

\item{reporting}{: enable/disable the reporting function.}
}
\value{
A data frame with stability indices. Columns include at least
  \code{energy.gap}, \code{ss.entropy}, \code{e.realize}, \code{e.stable}, \code{state.id}, and \code{stable.state.id}
  (and may include \code{conv_time} and \code{convergence} depending on the branch).
}
\description{
Calculate energy gap and stable state entropy as stability indices and returns a dataframe.

For each sample state, this function identifies the basin (stable state) by \link{Bi},
then computes (i) the energy gap and (ii) stable state entropy
estimated by \link{SSentropy}. 
If \code{enmat} is provided and \code{sa} was estimated with environmental
factors, the basin assignment is computed for each sample-specific \code{env}. 

Note: the returned stable state id corresponds to the basin (stable state) the sample is assigned to.
}
