bivariate_quantiles module¶
This takes in observations of a bivariate random variable y
and computes vector quantiles and vector ranks à la Chernozhukov-Galichon-Hallin-Henry (Ann. Stats. 2017).
Note
if the math looks strange in the documentation, just reload the page.
The sequence of steps is as follows:
- choose a number of Chebyshev nodes for numerical integration and optimize the weights:
v = solve_for_v(y, n_nodes)
- to obtain the \((u_1,u_2)\) quantiles for \((u_1, u_2)\in [0,1]\), run
qtiles_y = bivariate_quantiles_v(y, v, u1, u2)
- to compute the vector ranks for all points in the sample (the barycenters of the cells in the power diagram):
ranks_y = bivariate_ranks_v(y, v, n_nodes)
Steps 1 and 2 can be combined: qtiles_y = bivariate_quantiles(y, v, u1, u2, n_nodes)
Steps 1 and 3 can be combined: ranks_y = bivariate_ranks(y, n_nodes)
bivariate_quantiles(y, u, n_nodes=32, verbose=False)
¶
computes the bivariate quantiles of y
at the quantiles u
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
the observations, an |
required |
u |
ndarray
|
the quantiles at which to compute the bivariate quantiles,
an |
required |
n_nodes |
int
|
the number of nodes to use for the quadrature |
32
|
verbose |
bool
|
if |
False
|
Returns:
Type | Description |
---|---|
ndarray
|
an |
Source code in bs_python_utils/bivariate_quantiles.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
bivariate_quantiles_v(y, u, v)
¶
computes the vector quantiles of y
at values u
, given the converged v
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
the observations, an |
required |
u |
ndarray
|
the values where we want the quantiles, an |
required |
v |
ndarray
|
the converged values of the weights, an |
required |
Returns:
Type | Description |
---|---|
ndarray
|
an |
Source code in bs_python_utils/bivariate_quantiles.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
bivariate_ranks(y, n_nodes=32, verbose=False)
¶
computes the bivariate ranks of y
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
the observations, an |
required |
n_nodes |
int
|
the number of nodes to use for the quadrature |
32
|
verbose |
bool
|
if |
False
|
Returns:
Type | Description |
---|---|
ndarray
|
the |
Source code in bs_python_utils/bivariate_quantiles.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
bivariate_ranks_v(y, v, n_nodes=32, presorted=False)
¶
computes the vector ranks of y
, given the converged v
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
the observations, an |
required |
v |
ndarray
|
the converged values of the weights, an |
required |
n_nodes |
int
|
the number of nodes for Chebyshev integration |
32
|
presorted |
bool
|
if |
False
|
Returns:
Type | Description |
---|---|
ndarray
|
an |
Source code in bs_python_utils/bivariate_quantiles.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|