MFdiv | R Documentation |
Multifunctionality divergence (MFdiv) was calculated to quantify the degree of difference between different functions of an ecosystem. MFdiv was calculated by the mean pairwise distance method.
MFdiv(data, weights = NULL, cor = FALSE)
data |
A data frame or matrix where rows represent observations and columns represent functions. |
weights |
A numeric vector of weights for each function (column). If NULL, equal weights are assigned. |
cor |
Logical. If TRUE, calculates MFdiv with redundancy correction based on correlation between functions. If FALSE, calculates uncorrected MFdiv. |
To measure MFdiv quantitatively, we employ the mean pairwise distance method (Webb et al., 2002).
For uncorrected MFdiv, the formula is:
MFdiv = \frac{\sum_{i=1}^{n}\sum_{j=i+1}^{n}{w_i w_j D_{ij}}}{\sum_{i=1}^{n}\sum_{j=i+1}^{n}{w_i w_j}}
where D_{ij} = |f_i - f_j|
When redundancy correction is applied ('cor = TRUE'), the function accounts for correlations between ecosystem functions. The correction process involves:
1. Calculating a distance matrix based on correlations: d_{ij} = \sqrt{1 - |r_{ij}|}
2. Applying threshold-based correction: d_{ij}(\tau) = \min(d_{ij}, \tau)
3. Computing effective function values:
F_i(\tau) = \sum_{j=1}^{L}(1 - \frac{d_{ij}(\tau)}{\tau})f_j
4. Calculating the corrected MFdiv using these effective function values:
D_{ij}(\tau) = |F_i - F_j|
MFdiv = \frac{\sum_{i=1}^{n}\sum_{j=i+1}^{n}{w_i w_j D_{ij}(\tau)}}{\sum_{i=1}^{n}\sum_{j=i+1}^{n}{w_i w_j}}
5. The final result is the area under the curve (AUC) of MFdiv values across different tau thresholds.
A data frame with MFdiv values for each observation (row) in the input data.
data(forestfunctions)
head(forestfunctions)
MFdiv(forestfunctions[,6:31], cor = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.