Learn R Programming

popdemo (version 1.3-1)

isErgodic: Determine ergodicity of a matrix

Description

Determine whether a matrix is ergodic or nonergodic

Usage

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.

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

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.

References

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

See Also

Other PerronFrobeniusDiagnostics: isIrreducible(), isPrimitive()

Examples

Run this code
# NOT RUN {
  # 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)

# }

Run the code above in your browser using DataLab