% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/eigen.R
\name{stable_stage}
\alias{stable_stage}
\title{Compute the stable stage distribution}
\usage{
stable_stage(A, tol = 1e-12, ensure_positive = TRUE)
}
\arguments{
\item{A}{A square numeric matrix.}

\item{tol}{Numeric tolerance used for positivity/normalization checks.}

\item{ensure_positive}{Logical. If \code{TRUE}, attempts to orient the eigenvector so its
entries are mostly positive by flipping its sign if necessary.}
}
\value{
A numeric vector of length \code{nrow(A)} giving the stable stage distribution,
  normalized to sum to 1.
}
\description{
Returns the stable stage distribution for a square nonnegative matrix \code{A}, defined as the
right eigenvector associated with the dominant eigenvalue. The returned vector \code{w}
is normalized so that \code{sum(w) = 1}.
}
\details{
For matrix population models with nonegative irreducible matrix, stable stage densities are strictly
positive.
}
\examples{
#irreducible example
A <- matrix(c(
  0, 1,
  0.5, 0
), nrow = 2, byrow = TRUE)

w <- stable_stage(A)
w
sum(w)

}
\references{
Caswell, H. (2001). \emph{Matrix population models: construction, analysis and
interpretation} (2nd ed.). Sinauer.
}
