methods.hpp
1 // Copyright © 2020 Thomas Nagler
2 //
3 // This file is part of the wdm library and licensed under the terms of
4 // the MIT license. For a copy, see the LICENSE file in the root directory
5 // or https://github.com/tnagler/wdm/blob/master/LICENSE.
6 
7 #pragma once
8 
9 #include <cstddef>
10 #include <string>
11 
12 namespace wdm {
13 
14 namespace methods {
15 
16 inline bool
17 is_hoeffding(std::string method)
18 {
19  return (method == "hoeffding") || (method == "hoeffd") || (method == "d");
20 }
21 inline bool
22 is_kendall(std::string method)
23 {
24  return (method == "kendall") || (method == "ktau") || (method == "tau");
25 }
26 inline bool
27 is_pearson(std::string method)
28 {
29  return (method == "pearson") || (method == "prho") || (method == "cor");
30 }
31 inline bool
32 is_spearman(std::string method)
33 {
34  return (method == "spearman") || (method == "srho") || (method == "rho");
35 }
36 inline bool
37 is_blomqvist(std::string method)
38 {
39  return (method == "blomqvist") || (method == "bbeta") || (method == "beta");
40 }
41 inline bool
42 is_chatterjee(std::string method)
43 {
44  return (method == "chatterjee") || (method == "cxi") || (method == "xi");
45 }
46 
47 inline bool
48 is_supported(std::string method)
49 {
50  return is_hoeffding(method) || is_kendall(method) || is_pearson(method) ||
51  is_spearman(method) || is_blomqvist(method) || is_chatterjee(method);
52 }
53 
54 inline size_t
55 get_min_nobs(std::string method)
56 {
57  if (is_hoeffding(method)) {
58  return 5;
59  } else {
60  return 2;
61  }
62 }
63 
64 }
65 
66 }
Weighted dependence measures.
Definition: wdm.hpp:19