plotting.plot_kriging_diagnostics

plot_kriging_diagnostics(
    std_residuals,
    outlier_scale_factor=1.0,
    best_kernel_name='Matérn 5/2',
    ax=None,
)

Diagnostic Plot: Visualizes Standardized LOO Residuals and the outlier factor gamma.

Plots a histogram of standardized LOO residuals e_i against the Standard Normal distribution N(0, 1) alongside a scatter plot against the [-3, 3] outlier threshold bounds. Equivalent to Figure 10 in Malkiel et al. (2026).

When gamma > 1 the residuals rescaled by 1/gamma are also shown, which puts the largest one exactly on the threshold. This is the right-hand axis of Malkiel et al. (2026) Fig. 10b: it shows how much the Kriging uncertainty would need to be inflated to remove every outlier. digiqual reports gamma as a diagnostic and does not apply it to the PoD.

Parameters

Name Type Description Default
std_residuals np.ndarray Array of standardized LOO residuals e_i. required
outlier_scale_factor float Outlier factor gamma = max(1, max|e_i| / 3). Defaults to 1.0. 1.0
best_kernel_name str Name of the selected Kriging kernel. Defaults to “Matérn 5/2”. 'Matérn 5/2'
ax optional Where to draw. None (default) creates a figure with the histogram and the outlier scatter side by side. A single Axes draws the histogram only. A pair (ax_hist, ax_scatter) draws both panels on the given axes, e.g. on two separate figures. None

Returns

Name Type Description
plt.Axes plt.Axes: The configured Matplotlib axis containing the plot.

Examples

import numpy as np
import matplotlib.pyplot as plt
from digiqual.plotting import plot_kriging_diagnostics

std_res = np.random.normal(0, 1, 50)
ax = plot_kriging_diagnostics(std_res, outlier_scale_factor=1.2, best_kernel_name="Matérn 5/2")
plt.show()