HSGP

A Hilbert space Gaussian process (HSGP) approximates a Gaussian process with a finite set of basis functions. In Abacus it provides a regularised function for components such as a smooth baseline. Basis size, covariance assumptions and hyperpriors all affect what that component can represent.

Basis size and model flexibility

The m setting controls the number of retained basis functions. Conditional on the GP hyperparameters, Abacus gives the basis coefficients Normal priors whose scales depend on the covariance’s spectral density. These priors can shrink high-frequency terms; they do not generally set them exactly to zero.

The number of basis coefficients is not an OLS residual-degrees-of-freedom calculation. Regularisation can make effective flexibility smaller than the basis count, but the data do not automatically select a uniquely correct amount of flexibility. Poorly constrained hyperparameters and baseline/media trade-offs can remain even when fitting succeeds.

Select and check the approximation

HSGP.parameterize_from_data(...) recommends m and the boundary extent from the supplied data and lengthscale settings. It provides a starting point, not proof that the approximation is adequate for the fitted posterior.

A basis that is too small can miss variation permitted by the covariance. Increasing m can change the fitted function until the approximation is adequate, and increases computation. There is no guarantee that m=50 and m=500 produce identical curves. Assess both approximation settings and hyperprior sensitivity; do not choose them solely to obtain a preferred media result. Riutort-Mayol et al. describe basis and boundary selection and diagnostics for approximation adequacy.

Baseline and media remain competing explanations

A regularised baseline can still explain variation that also aligns with media. Orthogonality among mathematical basis functions does not imply orthogonality to the observed media design. Shrinkage changes the allocation of variation; it does not remove omitted confounding or identify the causal media contribution.

Check whether substantive results change across plausible baseline and prior specifications, as well as whether the total fit changes. See Baseline vs Media Trade-Offs.

Choose between Fourier and HSGP seasonality

Component Assumption and practical consideration
YearlyFourier A finite seasonal basis with the configured coefficient priors; order controls retained harmonics
HSGP A finite approximation to a non-periodic GP; covariance and hyperpriors control smoothness and scale
HSGPPeriodic A finite periodic GP approximation; the seasonal function repeats at its configured period

The retained HSGPPeriodic does not introduce slowly drifting seasonal coefficients. Modelling changing seasonal shape requires an explicit model for that change; choosing this class alone does not provide one.

HSGP uses a basis representation rather than the full observation covariance factorisation of an exact GP. Its cost still depends on basis size, model structure and sampling behaviour. Neither HSGP nor Fourier is universally superior. Use Seasonality and Trends for supported configuration, then assess predictive behaviour and attribution sensitivity for the intended task.

Model dated events explicitly

A holiday indicator and a smooth dated-event basis encode different temporal shapes. Choose according to the event’s expected duration and the data; a smooth build-up and decay is not always more realistic than an indicator.

For event attachment, use the example and prerequisites in Additive Effects and Events. Attach the effect to an unbuilt model, then build and fit with matching X and y. Event effects add explanatory components; they are not lift-test calibration. Check that reference’s persistence limitation before saving a model containing events.