Weighted dependence measures.
More...
|
| double | wdm (std::vector< double > x, std::vector< double > y, std::string method, std::vector< double > weights=std::vector< double >(), bool remove_missing=true, std::vector< int > seeds=std::vector< int >()) |
| |
| double | wdm (const Eigen::VectorXd &x, const Eigen::VectorXd &y, std::string method, Eigen::VectorXd weights=Eigen::VectorXd(), bool remove_missing=true, std::vector< int > seeds=std::vector< int >()) |
| |
| Eigen::MatrixXd | wdm (const Eigen::MatrixXd &x, std::string method, Eigen::VectorXd weights=Eigen::VectorXd(), bool remove_missing=true, std::vector< int > seeds=std::vector< int >()) |
| |
Weighted dependence measures.
◆ wdm() [1/3]
| Eigen::MatrixXd wdm::wdm |
( |
const Eigen::MatrixXd & |
x, |
|
|
std::string |
method, |
|
|
Eigen::VectorXd |
weights = Eigen::VectorXd(), |
|
|
bool |
remove_missing = true, |
|
|
std::vector< int > |
seeds = std::vector<int>() |
|
) |
| |
|
inline |
Calculates all pairwise dependence measures between matrix columns.
- Parameters
-
| x | matrix with observations in rows and variables in columns. |
| method | any method name accepted by the vector overload. |
| weights | optional case weights for the rows. |
| remove_missing | whether each pair should remove rows containing a NaN. |
| seeds | optional seeds for random Chatterjee predictor-tie breaking. |
- Returns
- A matrix of pairwise dependence measures. Chatterjee matrices are generally asymmetric; all other supported measures produce symmetric matrices.
- Exceptions
-
| std::runtime_error | if x has exactly one column or a pairwise call rejects its inputs. |
◆ wdm() [2/3]
| double wdm::wdm |
( |
const Eigen::VectorXd & |
x, |
|
|
const Eigen::VectorXd & |
y, |
|
|
std::string |
method, |
|
|
Eigen::VectorXd |
weights = Eigen::VectorXd(), |
|
|
bool |
remove_missing = true, |
|
|
std::vector< int > |
seeds = std::vector<int>() |
|
) |
| |
|
inline |
Calculates a dependence measure for two Eigen vectors.
- Parameters
-
| x,y | input vectors of equal length. |
| method | any method name accepted by the std::vector overload. |
| weights | optional case weights subject to the same validation as the std::vector overload. |
| remove_missing | whether to remove rows containing a NaN. |
| seeds | optional seeds for random Chatterjee predictor-tie breaking. |
- Returns
- The result of the corresponding
std::vector overload.
- Exceptions
-
| std::runtime_error | under the same conditions as that overload. |
◆ wdm() [3/3]
| double wdm::wdm |
( |
std::vector< double > |
x, |
|
|
std::vector< double > |
y, |
|
|
std::string |
method, |
|
|
std::vector< double > |
weights = std::vector<double>(), |
|
|
bool |
remove_missing = true, |
|
|
std::vector< int > |
seeds = std::vector<int>() |
|
) |
| |
|
inline |
Calculates a weighted or unweighted dependence measure.
- Parameters
-
| x,y | input vectors of equal length. For Chatterjee's xi, x is the predictor and y is the response. |
| method | the dependence measure; see details for possible values. |
| weights | optional case weights. Nonempty weights must match the input length, be finite and nonnegative, and have a positive sum. Their scale does not affect the result, and zero-weight rows are ignored. |
| remove_missing | if true, rows containing a NaN are removed; otherwise a NaN raises an exception. |
| seeds | optional seeds for random Chatterjee predictor-tie breaking. |
Available methods:
"pearson", "prho", "cor": Pearson correlation
"spearman", "srho", "rho": Spearman's \( \rho \)
"kendall", "ktau", "tau": Kendall's \( \tau \)
"blomqvist", "bbeta", "beta": Blomqvist's \( \beta \)
"hoeffding", "hoeffd", "d": Hoeffding's \( D \)
"chatterjee", "cxi", "xi": Chatterjee's \( \xi \)
- Note
- Chatterjee's xi is asymmetric. Predictor ties are broken without consulting the response; use
seeds for a reproducible ordering.
- Returns
- The requested estimate, or
NaN if missing-value removal leaves fewer than two observations (five for Hoeffding's D).
- Exceptions
-
| std::runtime_error | for size mismatches, invalid weights, unknown methods, disallowed missing or insufficient input, or an undefined Chatterjee estimate with a constant response. |