is_leslie_matrix {Rage}R Documentation

Determine if a matrix is a Leslie matrix population model

Description

Checks if a given matrix is a Leslie matrix. A matrix is determined to be a Leslie matrix if it satisfies the following conditions: * All elements of A are non-negative. * The subdiagonal elements of A, excluding the last column, are all between 0 and 1. * The sum of the elements in the first row (representing reproduction) of A is positive. * The upper triangle of A, excluding the first row, contains only 0s. * The diagonal of A, excluding the top-left and bottom-right corners contain only 0s. * The lower triangle of A, excluding the subdiagonal, contains only 0s.

Usage

is_leslie_matrix(A, includes_mat_F = TRUE)

Arguments

A

Matrix to be tested

includes_mat_F

A logical argument (default 'TRUE') indicating whether A is expected to include fecundity. The idea here is that A may not include fertility, but could still be a valid Leslie matrix if fertility was truly measured to be 0, or if fertility was not measured at all. Thus, this argument relaxes the test for the first row of A summing to a positive value.

Value

A logical value indicating whether the matrix is a Leslie matrix or not

Author(s)

Owen Jones <jones@biology.sdu.dk>

See Also

Other transformation: leslie_collapse(), mpm_collapse(), mpm_rearrange(), mpm_split(), mpm_standardize(), name_stages(), repro_stages(), standard_stages()

Examples

A <- matrix(c(
  0.1, 1.2, 1.1,
  0.1, 0.0, 0.0,
  0.0, 0.2, 0.3
), nrow = 3, byrow = TRUE)
is_leslie_matrix(A) # true
A <- matrix(c(
  0.1, 1.2, 1.1,
  0.1, 0.2, 0.1,
  0.2, 0.3, 0.3
), nrow = 3, byrow = TRUE)
is_leslie_matrix(A) # false

data(leslie_mpm1)
A <- leslie_mpm1$matU + leslie_mpm1$matF
is_leslie_matrix(A) # false


[Package Rage version 1.6.0 Index]