% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/runELA.R
\name{gStability}
\alias{gStability}
\title{gstability}
\usage{
gStability(
  sa,
  ocmat,
  enmat = NULL,
  seitr = 1000,
  seconvTime = 10000,
  pruning_type = "relative",
  th = 0.1,
  lower_qr = 0.05,
  threads = 1,
  reporting = TRUE,
  bs_params = NULL
)
}
\arguments{
\item{sa}{: output of runSA function.}

\item{ocmat}{: matrix of presence/absence status for each sample.}

\item{enmat}{: matrix 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{pruning_type}{the type of pruning \code{"relative"}(use with \code{th}) or \code{"bootstrap"} (use with \code{lower_qr} and \code{bootstrap_ene})}

\item{th}{: Numerical (0~1). Ratio of the depth of the basin to be pruned with respect to the deepest basin in each pair.}

\item{lower_qr}{Numeric value. Quantile used for constructing confidence intervals from bootstrap samples to check 
whether the estimated energy gaps include zero. Default is \code{lower_qr = 0.05},necessary when \code{type="bootstrap"}.}

\item{threads}{number of cores (threads) used for calculation.#' @param threads : number of cores (threads) used for calculation.}

\item{reporting}{: enable/disable the reporting function.}

\item{bs_params}{output of \link{bootstrap_SA}. list of estimated parameters using bootstrap resampled data set,
necessary when \code{type="bootstrap"}.}
}
\value{
A list of four elements: (1) pruned stability data frame, (2) non-pruned stability data frame,
  (3) auxiliary object for pruned landscape (parameters + stable states table), and
  (4) auxiliary object for sample-wise evaluation (inputs and ELA objects).
}
\description{
Calculate energy gap, energy barrier and stable state entropy.

This function evaluates stability indices for both (i) the pruned and (ii) the non-pruned
energy landscape. For each sample, it assigns the basin by \link{Bi} and computes:
 - energy gap (sample energy minus basin energy),
 - energy barrier (minimum tipping energy connected to the basin minus basin energy),
 - stable state entropy (\code{SSentropy}).

For basin connectivity: when only one stable state exists, tipping energy is treated as \code{Inf}
and therefore energy barrier is returned as \code{Inf}.
}
