multiple_inference.rank_condition#
Inference after ranking.
References
@techreport{andrews2019inference,
title={ Inference on winners },
author={ Andrews, Isaiah and Kitagawa, Toru and McCloskey, Adam },
year={ 2019 },
institution={ National Bureau of Economic Research }
}
@article{andrews2022inference,
Author = {Andrews, Isaiah and Bowen, Dillon and Kitagawa, Toru and McCloskey, Adam},
Title = {Inference for Losers},
Journal = {AEA Papers and Proceedings},
Volume = {112},
Year = {2022},
Month = {May},
Pages = {635-42},
DOI = {10.1257/pandp.20221065},
URL = {https://www.aeaweb.org/articles?id=10.1257/pandp.20221065}
}
Classes
|
Rank condition quantile-unbiased estimator. |
|
Quantile-unbiased results. |
- class multiple_inference.rank_condition.RankCondition(*args: Any, xmean: Sequence[float] | None = None, xycov: ndarray | None = None, **kwargs: Any)[source]#
Rank condition quantile-unbiased estimator.
Provides utilities for obtaining quantile-unbiased estimates conditional on the rank-ordering of conventional estimates of policy effects.
Subclasses
multiple_inference.base.ModelBase
.- Parameters:
*args (Any) – Passed to
multiple_inference.base.ModelBase
.xmean (Numeric1DArray, optional) – (# params,) array of conventional estimates to use for ranking. If None, ranking conditions are based on
mean
. Defaults to None.xycov (np.ndarray, optional) – (# params, # params) covariance matrix between
mean
andxmean
. Defaults to None.**kwargs (Any) – Passed to
multiple_inference.base.ModelBase
.
- Raises:
ValueError – Either all or none of
xmean
,xcov
andxycov
must be specified.
- Additional attributes:
- xmean (np.ndarray): (# params,) array of conventional estimates to use for
ranking.
- xycov (np.ndarray): (# params, # params) covariance matrix between
self.mean
and
self.xmean
.
Examples
Compute a quantile-unbiased distribution of the x4 parameter given that it was the top-ranked parameter.
import numpy as np from multiple_inference.rank_condition import RankCondition model = RankCondition(np.arange(5), np.identity(5)) dist = model.get_marginal_distribution("x4") print(dist.ppf([.025, .5, .975]))
[0.06742731 3.68627552 5.93267239]
Compute an “almost” quantile-unbiased hybrid distribution.
dist = model.get_marginal_distribution("x4", beta=.005) print(dist.ppf([.025, .5, .975]))
[0.89034671 3.68742998 5.93290012]
Summarize the quantile-unbiased results.
results = model.fit() print(results.summary())
Rank condition quantile-unbiased estimates =============================================== coef (median) pvalue (1-sided) [0.025 0.975] ----------------------------------------------- x0 0.314 0.406 -1.933 3.933 x1 1.000 0.285 -2.922 4.922 x2 2.000 0.136 -1.922 5.922 x3 3.000 0.058 -0.922 6.922 x4 3.686 0.023 0.067 5.933 =============== Dep. Variable y ---------------
Summarize the “almost” quantile-unbiased hybrid results.
results = model.fit(beta=.005) print(results.summary())
Rank condition quantile-unbiased estimates =============================================== coef (median) pvalue (1-sided) [0.025 0.975] ----------------------------------------------- x0 0.313 0.409 -1.977 3.129 x1 1.000 0.288 -2.129 4.129 x2 2.000 0.140 -1.129 5.129 x3 3.000 0.042 -0.129 6.129 x4 3.687 0.005 0.871 5.977 =============== Dep. Variable y ---------------
- get_marginal_distribution(column: str | int, ranks: Sequence[float] | None = None, beta: float = 0, **kwargs: Any) quantile_unbiased [source]#
Compute a quantile-unbiased distribution for a given ranking condition.
- Parameters:
column (ColumnType) – Name or index of the parameter of interest. Defaults to None.
ranks (Numeric1DArray, optional) – Ranking conditions for the parameter of interest. This method returns a quantile-unbiased distribution given that the estimated rank of the parameter of interest is in
ranks
. If None, the estimated rank of the parameter is used as the ranking condition. Defaults to None.beta (float, optional) – Used to compute the projection quantile for hybrid estimation. Defaults to 0.
**kwargs (Any) – Passed to
quantile_unbiased
.
- Returns:
Quantile-unbiased distribution.
- Return type:
- class multiple_inference.rank_condition.RankConditionResults(*args: Any, beta: float = 0, marginal_distribution_kwargs: Mapping[str, Any] | None = None, **kwargs: Any)[source]#
Quantile-unbiased results.
Inherits from
multiple_inference.base.ResultsBase
.- Parameters:
*args (Any) – Passed to
multiple_inference.base.ResultsBase
.beta (float, optional) – Used to compute the projection quantile for hybrid estimation. Defaults to 0.
marginal_distribution_kwargs (Mapping[str, Any], optional) – Passed to
RankCondition.get_marginal_distribution()
. Defaults to None.**kwargs (Any) – Passed to
multiple_inference.base.ResultsBase
.