View source: R/svdcentrality.R
calc_svd_entropy_importance | R Documentation |
This function performs Singular Value Decomposition (SVD) on a network adjacency matrix. It computes species importance based on the dominant singular values and returns entropy, rank, and key visualizations.
calc_svd_entropy_importance(A, threshold_factor = 1e-06)
A |
A square adjacency matrix where rows represent prey and columns represent predators. The values represent interaction strengths. |
A list containing:
Rank |
The numerical rank of the matrix after small values are rounded for numerical stability. |
Entropy |
The entropy of the singular value distribution. |
Prey_Importance |
A data frame ranking prey species by their contribution to the largest singular value. |
Predator_Importance |
A data frame ranking predator species by their contribution to the largest singular value. |
Singular_Values |
A numeric vector of the singular values of the matrix. |
Plot_Singular_Values |
A ggplot object showing the distribution of singular values. |
Plot_Prey_Importance |
A ggplot object showing the top prey species contributing to the largest singular value. |
Plot_Predator_Importance |
A ggplot object showing the top predator species contributing to the largest singular value. |
results <- calc_svd_entropy_importance(netData[[1]])
print(results$Rank)
print(results$Entropy)
print(results$Plot_Singular_Values)
print(results$Plot_Prey_Importance)
print(results$Plot_Predator_Importance)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.