bivariate_quantiles module¶
Bivariate vector quantiles and ranks.
This module implements the bivariate case of the vector quantiles and vector ranks construction of Chernozhukov, Galichon, Hallin, and Henry (2017).
The main workflow is:
- Solve for the dual weights
vwith :func:_solve_for_v. - Evaluate quantiles with :func:
bivariate_quantiles_vor :func:bivariate_quantiles. - Read off barycentric ranks with :func:
bivariate_ranks.
References
Chernozhukov, Galichon, Hallin, and Henry. "Monge-Kantorovich Depth, Quantiles, Ranks and Signs." Annals of Statistics 45(1), 2017.
bivariate_quantiles(y, tau, n_nodes=32, verbose=False)
¶
Solve for the dual weights and evaluate bivariate quantiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
Observations with shape |
required |
tau
|
ndarray
|
Query points in |
required |
n_nodes
|
int
|
Number of Chebyshev nodes for the quadrature. |
32
|
verbose
|
bool
|
Print optimisation diagnostics when |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Bivariate quantiles evaluated at |
Source code in bs_python_utils/stats/bivariate_quantiles.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
bivariate_quantiles_v(y, tau, v)
¶
Evaluate vector quantiles for fixed dual weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
Observations with shape |
required |
tau
|
ndarray
|
Evaluation points in |
required |
v
|
ndarray
|
Dual weights solving the optimal transport problem, with length
|
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of quantile locations with shape |
Raises:
| Type | Description |
|---|---|
SystemExit
|
If |
Source code in bs_python_utils/stats/bivariate_quantiles.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
bivariate_ranks(y, n_nodes=32, verbose=False)
¶
Compute barycentric ranks for each observation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
Observations with shape |
required |
n_nodes
|
int
|
Number of Chebyshev nodes used in the quadrature. |
32
|
verbose
|
bool
|
Print diagnostics when |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of average ranks (shape |
Source code in bs_python_utils/stats/bivariate_quantiles.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |