# isErgodic: Determine ergodicity of a matrix In popdemo: Demographic Modelling Using Projection Matrices

## Description

Determine whether a matrix is ergodic or nonergodic

## Usage

 `1` ```isErgodic(A, digits = 12, return.eigvec = FALSE) ```

## Arguments

 `A` a square, non-negative numeric matrix of any dimension. `digits` the number of digits that the dominant left eigenvector should be rounded to. `return.eigvec` (optional) logical argument determining whether or not the dominant left eigenvector should be returned.

## Details

`isErgodic` works on the premise that a matrix is ergodic if and only if the dominant left eigenvector (the reproductive value vector) of the matrix is positive (Stott et al. 2010).

In rare cases, R may calculate that the dominant left eigenvector of a nonergodic matrix contains very small entries that are approximate to (but not equal to) zero. Rounding the dominant eigenvector using `digits` prevents mistakes.

## Value

If `return.eigvec=FALSE`, either `TRUE` (for an ergodic matrix) or `FALSE` (for a nonergodic matrix).

If `return.eigvec=TRUE`, a list containing elements:

`ergodic`

`TRUE` or `FALSE`, as above

`eigvec`

the dominant left eigenvector of `A`

## References

• Stott et al. (2010) Methods Ecol. Evol., 1, 242-252.

Other PerronFrobeniusDiagnostics: `isIrreducible()`, `isPrimitive()`
 ``` 1 2 3 4 5 6 7 8 9 10 11``` ``` # Create a 3x3 ergodic PPM ( A <- matrix(c(0,0,2,0.5,0.1,0,0,0.6,0.6), byrow=TRUE, ncol=3) ) # Diagnose ergodicity isErgodic(A) # Create a 3x3 nonergodic PPM B<-A; B[3,2] <- 0; B # Diagnose ergodicity and return left eigenvector isErgodic(B, return.eigvec=TRUE) ```