Skip to contents

Build a climatic weighting metric

Usage

niche_metric(sensitivity = NULL, cnfa = NULL, type = c("diag", "factor"))

Arguments

sensitivity

Numeric vector of climatic metric weights used by the diagonal metric. For a factor metric, complete names can be used to order the CENFA loading rows.

cnfa

Optional CENFA cnfa object or compatible list. A diagonal metric can use sf; a factor metric requires co and eig.

type

Metric type. "diag" uses variable-level climatic weights. "factor" uses a factor metric when CENFA factor coordinates are available.

Value

A positive semi-definite matrix.

Details

For climatic weights \(s_j\), the diagonal metric is $$A = \mathrm{diag}(s / \bar{s}).$$ For a CENFA loading matrix \(U\) and factor eigenvalues \(\rho\), the factor metric is $$A = U\,\mathrm{diag}(\rho / \bar{\rho})\,U^{\mathsf{T}}.$$ The factor metric is constructed from co and eig; a separate sensitivity vector is not combined with it. This quadratic metric is a climniche construction from CENFA components, not a metric returned by CENFA itself.

The argument name sensitivity is retained for API compatibility. Its values define the relative scale of climatic distance; they are not physiological sensitivity estimates unless supplied from an independent analysis.

Examples

niche_metric(c(temperature = 2, salinity = 1, oxygen = 0.5))