lf2i.confidence_regions package

Submodules

lf2i.confidence_regions.neyman_inversion module

lf2i.confidence_regions.neyman_inversion.compute_confidence_regions(calibration_method: str, test_statistic: ndarray | None, parameter_grid: ndarray, critical_values: ndarray | None, p_values: ndarray | None, alpha: float | None, acceptance_region: str | None, poi_dim: int, return_indices: bool = False) List[ndarray][source]

Compute LF2I confidence regions via Neyman inversion of hypothesis tests.

Parameters:
  • calibration_method (str) – Either critical-values or p-values.

  • test_statistic (np.ndarray) – Test statistic evaluated at all values in the parameter grid for each observation. Should have dimensions (num_observations, parameter_grid_size). Only used if calibration_method = ‘critical-values.

  • parameter_grid (np.ndarray) – Grid over the parameter space which contains the evaluation points that will or will not be included in the confidence region.

  • critical_values (np.ndarray) – Critical values evaluated at all values in the parameter grid. Only used if calibration_method = ‘critical-values.

  • p_values (np.ndarray, optional) – Array of p-values evaluated at all values in the parameter grid for each observation, against which to compare the provided level \(lpha\). Only used if calibration_method = ‘p-values. Should have dimensions (num_observations, parameter_grid_size).

  • acceptance_region (str) – Whether the acceptance region for the test statistic is defined to be on the right or on the left of the critical value. Must be either left or right. Only used if calibration_method = ‘critical-values.

  • alpha (float, optional) – If calibration_method = ‘p-values, used to decide whether the test rejects or not, otherwise ignored.

  • poi_dim (int) – Dimensionality (number) of the parameter of interest.

  • return_indices (bool) – Whether to return which rows (indices) of the evaluation grid correspond to points retained in the region. Default ‘False’.

Returns:

List[np.ndarray] – Sequence whose i-th element is the confidence region for the i-th observation used to evaluate the test statistic.

Raises:

ValueError – Acceptance region must be either left or right.