Learn R Programming

popdemo (version 0.2-3)

is.matrix_ergodic: Determine ergodicity of a matrix

Description

Determine whether a matrix is ergodic or nonergodic

Usage

is.matrix_ergodic(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:
  • ergodicTRUE or FALSE
  • eigvecthe dominant left eigenvector of A.

Details

is.matrix_ergodic 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, Rmay 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

is.matrix_primitive, is.matrix_irreducible.

Examples

Run this code
# 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)
    A

    # Diagnose ergodicity
    is.matrix_ergodic(A)

    # Create a 3x3 nonergodic PPM
    B<-A
    B[3,2] <- 0
    B

    # Diagnose ergodicity and return
    # left eigenvector
    is.matrix_ergodic(B, return.eigvec=TRUE)

Run the code above in your browser using DataLab