normalizeJacobian: Normalize the Jacobian matrix

View source: R/get_jacobian.R

normalizeJacobianR Documentation

Normalize the Jacobian matrix

Description

This function normalizes the Jacobian matrix by dividing each row by the corresponding absolute diagonal value.

Usage

normalizeJacobian(JM, dead_names = NULL, allzero = TRUE)

Arguments

JM

(required) A square named Jacobian matrix with numeric values representing the effect of one compartment (rows) on another compartment (columns). The diagonal must be quantified, and cannot contain zeroes.

dead_names

(required if allzero is TRUE and there are dead compartments in the system) Character vector with the names of all dead compartments.

allzero

Boolean. Default TRUE. Sets all diagonal values - except for dead compartments - to zero after normalisation. If set to FALSE, the normalized Jacobian will have -1 for each diagonal value.

Value

Returns a normalized Jacobian matrix with either an all-zero (except detritus) diagonal or a diagonal with -1.

References

Neutel, A. M., & Thorne, M. A. S. (2014). Interaction strengths in balanced carbon cycles and the absence of a relation between ecosystem complexity and stability. Ecology Letters, 17(6), 651–661. https://doi.org/10.1111/ele.12266

Examples

model <- fwmodels::LovinkhoeveCP
JM <- getJacobian(model)
# Normalize the matrix, all diagonal values will be set to 0 after normalization
normalizeJacobian(JM)
# Normalize the matrix, all diagonal values will be set to -1 after normalization
normalizeJacobian(JM, allzero = FALSE)

dswdejonge/fwstability documentation built on Dec. 7, 2022, 7:24 p.m.