Compute Correlation Matrix Between Family Indices
Source:R/analysis-correlation.R
compute_family_correlations.RdCalculates pairwise correlations between family composite indices to identify synergies and trade-offs across ecosystem service dimensions.
Details
The function computes pairwise correlations between selected family indices to reveal ecological relationships: - **Positive correlations** suggest synergies (e.g., Biodiversity × Age) - **Negative correlations** indicate trade-offs (e.g., Protection × Risk) - **Near-zero correlations** show independence
Missing values (NA) are handled using pairwise complete observations.
See also
[identify_hotspots()], [plot_correlation_matrix()]
Other analysis:
identify_hotspots()
Examples
if (FALSE) { # \dontrun{
# Load demo data with family indices
data(massif_demo_units)
units <- massif_demo_units
units$family_B <- runif(nrow(units), 30, 90)
units$family_T <- runif(nrow(units), 40, 85)
units$family_C <- runif(nrow(units), 45, 80)
# Compute correlation matrix
corr_matrix <- compute_family_correlations(units)
print(corr_matrix)
# Use Spearman for non-linear relationships
corr_spearman <- compute_family_correlations(units, method = "spearman")
# Analyze specific families only
corr_subset <- compute_family_correlations(
units,
families = c("family_B", "family_T")
)
} # }