Skip to content

API

The supported Python API centers on the compiled closed e-BH and closed BY wrappers. The functions below are the public, documented entry points intended for direct use from installed packages and wheels.

Closed testing procedures

closedeBH

closedeBH

closedeBH(evalues, subset=None, alpha=0.05, approximate=False)

Run closed e-BH in discovery mode or set-checking mode.

Parameters:

Name Type Description Default
evalues Sequence[float]

One-dimensional sequence of e-values.

required
subset Iterable[int] | None

If None, return the number of discoveries. Otherwise check whether the specified subset is mean consistent. A subset may be given either as a boolean mask or as 0-based integer indices.

None
alpha float

Target FDR level in (0, 1].

0.05
approximate bool

If True, use the approximate discovery-mode routine.

False

Returns:

Type Description
int | bool

An integer discovery count when subset is None, otherwise a single

int | bool

boolean.

Examples:

>>> closedeBH([1.0, 100.0], alpha=0.05)
1
>>> closedeBH([1.0, 100.0], subset=[1], alpha=0.05)
True

closedBY

closedBY

closedBY(pvalues, subset=None, alpha=0.05, approximate=False)

Run closed BY in discovery mode or set-checking mode.

Parameters:

Name Type Description Default
pvalues Sequence[float]

One-dimensional sequence of p-values.

required
subset Iterable[int] | None

If None, return the number of discoveries. Otherwise check whether the specified subset is significant. A subset may be given either as a boolean mask or as 0-based integer indices.

None
alpha float

Target FDR level in [0, 1].

0.05
approximate bool

If True, use the approximate discovery-mode routine.

False

Returns:

Type Description
int | bool

An integer discovery count when subset is None, otherwise a single

int | bool

boolean.

Examples:

>>> closedBY([0.01, 0.5], alpha=0.05)
1
>>> closedBY([0.01, 0.5], subset=[0], alpha=0.05)
True