distributions.intervals¶
Module: distributions.intervals
¶
Inheritance diagram for selectinf.distributions.intervals
:
This module contains a class for forming confindence intervals and testing 1-dimensional linear hypotheses about the underlying mean vector of a Gaussian subjected to selection.
intervals_from_sample
¶
-
class
selectinf.distributions.intervals.
intervals_from_sample
(reference, sample, observed, covariance)[source]¶ Bases:
object
Construct confidence intervals for real-valued parameters by tilting a multiparameter exponential family with reference measure a Monte Carlo sample.
The exponential family is assumed to be derived from a Gaussian with some selective weight and the parameters are linear functionals of the mean parameter of the Gaussian.
-
__init__
(reference, sample, observed, covariance)[source]¶ - Parameters
reference : np.float(k)
Reference value of mean parameter. Often taken to be an unpenalized MLE or perhaps (approximate) selective MLE / MAP.
sample : np.float(s, k)
A Monte Carlo sample drawn from selective distribution.
observed : np.float(k)
Observed value of Gaussian estimator. Often an unpenalized MLE.
covariance : np.float(k, k)
Covariance of original Gaussian. Used only to compute unselective variance of linear functionals of the (approximately) Gaussian estimator.
-
pivots_all
(parameter=None)[source]¶ Compute pivotal quantities, i.e. the selective distribution function under \(H_{0,k}: heta_k= heta_{0,k}\) where :math:` heta_0` is parameter.
- Parameters
parameter : np.float(k) (optional)
Value of mean parameter under coordinate null hypotheses. Defaults to np.zeros(k)
- Returns
pivots : np.float(k)
Pivotal quantites. Each is (asymptotically) uniformly distributed on [0,1] under corresponding \(H_{0,k}\).
-
confidence_interval
(linear_func, level=0.9)[source]¶ Construct a `level*100`% confidence interval for a linear functional of the mean parameter of the underlying Gaussian.
- Parameters
linear_func : np.float(k)
Linear functional determining parameter.
level : float (optional)
Specify the confidence level.
- Returns
L, U : float
Lower and upper limits of confidence interval.
-
confidence_intervals_all
(level=0.9)[source]¶ Construct a level*100`% confidence interval for each :math: heta_j` of the mean parameter of the underlying Gaussian.
- Parameters
level : float (optional)
Specify the confidence level.
- Returns
LU : np.float(k,2)
Array with lower and upper confidence limits.
-