Compare Interpolation Methods

This guide shows how to evaluate HRTF template interpolation and the contribution of the elevation prior using likelihood-based model comparison (BIC). Two models are compared: a full model (sigma_spectral + sigma_prior free) and a reduced model (sigma_spectral only, sigma_prior fixed to a uniform distribution). A positive \(\Delta\mathrm{BIC}\) indicates that the elevation prior improves the fit beyond what is expected from the added parameter complexity.

Fit the full model and the no-prior model

Run fit_listener for the full model, then fit_listener_partial with sigma_prior fixed to a very large value (effectively uniform) for the no-prior model.

    import pandas as pd
    import pyfar as pf
    from bayesian_listener.fitting import fit_listener, fit_listener_partial

    obs_tbl       = pd.read_csv(DATA_CSV)
    targets        = obs_tbl[["azi_target", "ele_target"]].drop_duplicates()
    targets_coords = pf.Coordinates.from_spherical_elevation(
        np.deg2rad(targets["azi_target"].values),
        np.deg2rad(targets["ele_target"].values),
        np.ones(len(targets)),
    )

    results = fit_listener(
        sofa_path, obs_tbl, targets_coords,
        interpolation_method="SHMAX", num_repetitions=1)

    # fit only sigma_spectral (i.e. motor noise and prior fixed to default)
    results_noprior = fit_listener_partial(
        sofa_path, obs_tbl, targets_coords,
        interpolation_method="SHMAX",
        params_to_fit=["sigma_spectral"],
        num_repetitions=1,
        verbose=False,
    )

Compute BIC and delta-BIC

BIC penalises model complexity; lower is better. \(\Delta\mathrm{BIC} = \mathrm{BIC}_{\mathrm{no\,prior}} - \mathrm{BIC}_{\mathrm{full}}\) is positive when the elevation prior is justified.

    n_trials  = results["n_trials"]
    k_full    = 2  # sigma_spectral + sigma_prior (kappa_motor fixed in stage 1)
    k_noprior = 1  # sigma_spectral only

    bic_full = k_full * np.log(n_trials) + 2 * results["nll"]

    bic_noprior = k_noprior * np.log(n_trials) + 2 * results_noprior["nll"]

    delta_bic = bic_noprior - bic_full
    print(f"\nBIC (with prior): {bic_full:.1f}  BIC (no prior): {bic_noprior:.1f}  "
          f"ΔBIC = {delta_bic:.1f}")

Note

\(|\Delta\mathrm{BIC}| > 10\) is conventionally regarded as strong evidence in favour of the lower-BIC model (see [barumerli2026] in the Background page).

References

[barumerli2026]

R. Barumerli, F. Brinkmann, E. Zanoni, A. Hoyer, L. Picinali, and M. Geronazzo, “Statistical validation and full-sphere extension of a Bayesian model for human static sound localisation,” Submitted to Acta Acustica, 2026.