lmpy.statistics.pam_stats
Module containing base PAM statistic functionality.
Module Contents
Classes
Constructor. |
|
Constructor. |
|
Constructor. |
|
Constructor for PAM stats computations. |
|
Constructor. |
|
Constructor. |
|
Constructor. |
|
Constructor. |
|
Constructor. |
Functions
|
Calculate alpha diversity, the number of species in each site. |
|
Calculate proportional alpha diversity. |
|
Calculate the checker board score for the PAM. |
|
Calculate Lande's beta diversity metric for a PAM. |
|
Calculate Legendre's beta diversity metric for a PAM. |
|
Calculates the nearest neighbor distance. |
|
Calculates mean pairwise distance between species present at a site. |
|
Get the number of sites with presences. |
|
Get the number of species with presences. |
|
Calculate the range size per species. |
|
Calculate the mean proportional range size of each species. |
|
Calculates the Pearson correlation coefficient for each site. |
|
Calculate phi, the range size per site. |
Calculate proportional range size per site. |
|
|
Calculate phylogenetic diversity of a tree. |
|
Calculate the range richness of each species. |
Calculate the mean proportional species diversity. |
|
Calculate Schluter's site variance ratio. |
|
Calculate Schluter's species variance ratio. |
|
|
Compute the site sigma metric for a PAM. |
|
Compute the species sigma metric for a PAM. |
|
Calculates the sum pairwise distance for all species present at a site. |
|
Calculate Whittaker's beta diversity metric for a PAM. |
- class lmpy.statistics.pam_stats.CovarianceMatrixMetric(func)[source]
Bases:
PamStatsMetricConstructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.DiversityMetric(func)[source]
Bases:
PamStatsMetricConstructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.PamDistMatrixMetric(func)[source]
Bases:
_SiteStatMetricConstructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.PamStats(pam, tree=None, tree_matrix=None, node_heights_matrix=None, tip_lengths_matrix=None)[source]
Constructor for PAM stats computations.
- Parameters
pam (Matrix) – A presence-absence matrix to use for computations.
tree (TreeWrapper) – A tree to use for phylogenetic distance computations.
tree_matrix (Matrix) – A matrix of tip / node presence absence values.
node_heights_matrix (Matrix) – A matrix of node height values.
tip_lengths_matrix (Matrix) – A matrix of tip length values.
- calculate_covariance_statistics(self)[source]
Calculate covariance statistics matrices.
- Returns
A list of metric name, value tuples for covariance stats.
- Return type
list of tuple
- calculate_diversity_statistics(self)[source]
Calculate diversity statistics.
- Returns
A list of metric name, value tuples for diversity metrics.
- Return type
list of tuple
- calculate_site_statistics(self)[source]
Calculate site-based statistics.
- Returns
A matrix of site-based statistics for the selected metrics.
- Return type
- class lmpy.statistics.pam_stats.PamStatsMetric(func)[source]
Constructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.SiteMatrixMetric(func)[source]
Bases:
_SiteStatMetricConstructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.SpeciesMatrixMetric(func)[source]
Bases:
_SpeciesStatMetricConstructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.TreeDistanceMatrixMetric(func)[source]
Bases:
_SiteStatMetricConstructor.
- Parameters
func – The function to call.
- class lmpy.statistics.pam_stats.TreeMetric(func)[source]
Bases:
_SiteStatMetricConstructor.
- Parameters
func – The function to call.
- lmpy.statistics.pam_stats.alpha(pam)[source]
Calculate alpha diversity, the number of species in each site.
- lmpy.statistics.pam_stats.c_score(pam)[source]
Calculate the checker board score for the PAM.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
The checkerboard score for the PAM.
- Return type
float
- lmpy.statistics.pam_stats.lande(pam)[source]
Calculate Lande’s beta diversity metric for a PAM.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
Lande’s beta diversity for the PAM.
- Return type
float
- lmpy.statistics.pam_stats.legendre(pam)[source]
Calculate Legendre’s beta diversity metric for a PAM.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
Legendre’s beta diversity for the PAM.
- Return type
float
- lmpy.statistics.pam_stats.mean_nearest_taxon_distance(phylo_dist_mtx)[source]
Calculates the nearest neighbor distance.
- Parameters
phylo_dist_mtx (Matrix) – A matrix of distances between the species present at a site.
- Returns
The average distance from each taxa to taxa nearest to it.
- Return type
float
- lmpy.statistics.pam_stats.mean_pairwise_distance(phylo_dist_mtx)[source]
Calculates mean pairwise distance between species present at a site.
- Parameters
phylo_dist_mtx (Matrix) – A matrix of distances between the species present at a site.
- Returns
The average distance from each taxa all of the other co-located taxa.
- Return type
float
- lmpy.statistics.pam_stats.num_sites(pam)[source]
Get the number of sites with presences.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
The number of sites that have present species.
- Return type
int
- lmpy.statistics.pam_stats.num_species(pam)[source]
Get the number of species with presences.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
The number of species that are present in at least one site.
- Return type
int
- lmpy.statistics.pam_stats.omega_proportional(pam)[source]
Calculate the mean proportional range size of each species.
- lmpy.statistics.pam_stats.pearson_correlation(pam, phylo_dist_mtx)[source]
Calculates the Pearson correlation coefficient for each site.
- lmpy.statistics.pam_stats.phi_average_proportional(pam)[source]
Calculate proportional range size per site.
- lmpy.statistics.pam_stats.phylogenetic_diversity(tree)[source]
Calculate phylogenetic diversity of a tree.
- Parameters
tree (TreeWrapper) – A phylogenetic tree to compute phylogenetic diversity for.
- Returns
The sum of the edge lengths of the nodes of the provided tree.
- Return type
float
- lmpy.statistics.pam_stats.psi_average_proportional(pam)[source]
Calculate the mean proportional species diversity.
- lmpy.statistics.pam_stats.schluter_site_variance_ratio(pam)[source]
Calculate Schluter’s site variance ratio.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
The Schluter site variance ratio for the PAM.
- Return type
float
- lmpy.statistics.pam_stats.schluter_species_variance_ratio(pam)[source]
Calculate Schluter’s species variance ratio.
- Parameters
pam (Matrix) – The presence-absence matrix to use for the computation.
- Returns
The Schluter species variance ratio for the PAM.
- Return type
float
- lmpy.statistics.pam_stats.sum_pairwise_distance(phylo_dist_mtx)[source]
Calculates the sum pairwise distance for all species present at a site.
- Parameters
phylo_dist_mtx (Matrix) – A matrix of distances between the species present at a site.
- Returns
The total distance from each taxa all of the other co-located taxa.
- Return type
float