A library for working with phylogenetic and population genetic data.
v0.32.0
correlation.cpp File Reference
#include "genesis/utils/math/correlation.hpp"
#include "genesis/utils/math/common.hpp"
#include "genesis/utils/core/std.hpp"
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <unordered_map>
#include <vector>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::utils
 

Functions

double kendalls_tau_correlation_coefficient (std::vector< double > const &x, std::vector< double > const &y, KendallsTauMethod method=KendallsTauMethod::kTauB)
 Compute Kendall's Tau Correlation Coefficient. More...
 
double kendalls_tau_correlation_coefficient_clean_ (std::vector< double > const &x, std::vector< double > const &y, KendallsTauMethod method)
 Compute Kendall's Tau, expecting clean input without nan values, using Knight's algorithm. More...
 
double kendalls_tau_correlation_coefficient_naive (std::vector< double > const &x, std::vector< double > const &y, KendallsTauMethod method=KendallsTauMethod::kTauB)
 Compute a simple version of Kendall's Tau Correlation Coefficient. More...
 
size_t kendalls_tau_count_tau_c_m_ (std::vector< double > const &x, std::vector< double > const &y)
 Helper function to count the number of unique values in both lists, using only those entris that are finite in both. More...
 
template<typename T >
size_t kendalls_tau_count_ties_ (std::vector< T > const &values)
 Helper function to count the number of tied pairs induced by equal values. More...
 
size_t kendalls_tau_count_ties_sorted_ (std::vector< double > const &values)
 Helper function to count the number of tied pairs induced by equal values, on a sorted input list. More...
 
size_t kendalls_tau_count_ties_sorted_pairs_rank_ (std::vector< double > const &x, std::vector< double > const &y, std::vector< size_t > const &ranks)
 Helper function to count the number of tied pairs induced by equal values, on two input list with the sorting provided via a rank indexing list. More...
 
size_t kendalls_tau_count_ties_sorted_rank_ (std::vector< double > const &values, std::vector< size_t > const &ranks)
 Helper function to count the number of tied pairs induced by equal values, on a sorted input list with the sorting provided via a rank indexing list. More...
 
size_t kendalls_tau_merge_count_ (std::vector< double > &data, std::vector< double > &temp, size_t left, size_t mid, size_t right)
 Helper function for kendalls_tau_correlation_coefficient() to do a merge sort that counts the number of inversions performed. More...
 
double kendalls_tau_method_ (std::vector< double > const &x, std::vector< double > const &y, size_t const concordant, size_t const discordant, size_t const n, size_t const n0, size_t const n1, size_t const n2, size_t const n3, KendallsTauMethod method)
 Given counts of concordant and discordant pairs, compute the final value, applying the requested adjustments. More...
 
size_t kendalls_tau_sort_and_count_ (std::vector< double > &data, std::vector< double > &temp, size_t left, size_t right)
 Helper function for kendalls_tau_correlation_coefficient() to sort a list using merge sort, while counting the number of inversions performed. More...