pod.infer_best_distribution

infer_best_distribution(residuals, X, bandwidth)

Selects the best statistical distribution for the standardized residuals using AIC.

This function normalizes residuals by their local standard deviation (Z-scores) and tests them against a suite of candidate distributions (Normal, Gumbel, Logistic, Laplace, t-Student).

Parameters

Name Type Description Default
residuals np.ndarray Raw residuals from the mean model. required
X np.ndarray Input locations for the residuals. required
bandwidth float Bandwidth used for local standardization. required

Returns

Name Type Description
Tuple[str, Tuple] Tuple[str, Tuple]: - best_name: The SciPy name of the best-fitting distribution (e.g., ‘norm’). - best_params: The fitted parameters for that distribution (e.g., loc, scale).