distance_covariances module¶
Distance covariance and partial distance covariance à la Szekely and Rizzo; evaluation and tests of independence and conditional independence:
DcovResults
,PdcovResults
: classes for distance covariancesdcov_dcor
: `evaluates the distance covariance and correlation of two random variablespdcov_pdcor
: evaluates the partial distance covariance and correlation ofX
andY
givenZ
pvalue_dcov
: test of no dependence betweenX
andY
givenZ
.
dcov_dcor(X, Y, unbiased=False)
¶
evaluate the distance covariance and correlation of X
and Y
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
ndarray
|
|
required |
Y |
ndarray
|
|
required |
unbiased |
bool
|
if |
False
|
Returns:
Type | Description |
---|---|
DcovResults
|
|
Source code in bs_python_utils/distance_covariances.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
pdcov_pdcor(X, Y, Z)
¶
evaluate the partial distance covariance and correlation of X
and Y
given Z
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
ndarray
|
|
required |
Y |
ndarray
|
|
required |
Z |
ndarray
|
|
required |
Returns:
Type | Description |
---|---|
PdcovResults
|
a |
Source code in bs_python_utils/distance_covariances.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
pvalue_dcov(dcov_results, ndraws=199)
¶
test of no dependence between X
and Y
given Z
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dcov_results |
DcovResults
|
results from |
required |
ndraws |
int
|
the number of draws we use |
199
|
Returns:
Type | Description |
---|---|
float
|
the bootstrapped p-value of the test |
Source code in bs_python_utils/distance_covariances.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
pvalue_pdcov(pdcov_results, ndraws=199)
¶
test of no dependence between X
and Y
given Z
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pdcov_results |
PdcovResults
|
the results of |
required |
ndraws |
int
|
the number of draws we use |
199
|
Returns:
Type | Description |
---|---|
float
|
the bootstrapped p-value of the test |
Source code in bs_python_utils/distance_covariances.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|