PredictiveCheckTest.adequate#

PredictiveCheckTest.adequate(*, level=_EXTREME_PVALUE)[source]#

Whether no statistic sits in a tail of its replicated distribution.

The complement of extreme() being non-empty. For a posterior check, True says the model reproduces every checked feature of its own sample at the resolution the replications afford, which is a necessary condition for adequacy and not a sufficient one; the statistics were chosen, and a feature not among them is not checked. For a prior check it says only that the data are not in the prior’s tails, which a very diffuse prior satisfies trivially.

The verdict is over m * k cells at once with no multiplicity adjustment, and that is deliberate: the check is a diagnostic that names what to look at, not a test with a size. Under a correct model with independent statistics the chance that at least one of ten cells lands in a 5% tail on each side is \(1 - 0.9^{10} \approx 0.65\), and Meng’s concentration of posterior p-values near one half is what keeps the realized rate well below that. A single flagged cell near the boundary is a prompt to look at its row in summary(), not a rejection.

Parameters:

level (float) – The tail size on each side, as for extreme().

Return type:

bool

Returns:

True when extreme() is empty at this level.

Raises:

SpecificationError – If the level is not inside (0, 0.5).

Example

>>> import numpy as np
>>> rng = np.random.default_rng(12)
>>> y = rng.standard_normal((100, 2))
>>> check = replication_check(y, rng.standard_normal((200, 100, 2)))
>>> check.adequate(), check.adequate(level=0.4)
(True, False)