Additive Effects and Events
Abacus supports advanced additive components through mu_effects and dated
event surfaces.
These are extension points rather than the default modelling path, but they are part of the retained public API.
MuEffect protocol surface
Import path:
MuEffect is the abstract base class for additive components appended to
mmm.mu_effects.
Required methods:
| Method | Purpose |
|---|---|
create_data(mmm) |
Register any required pm.Data inputs |
create_effect(mmm) |
Return the additive contribution tensor |
set_data(mmm, model, X) |
Update the effect for new prediction data |
Custom effects should inherit from MuEffect so they can participate in model
serialization logic.
Built-in additive effect classes
Import path:
Built-in types:
| Type | Purpose |
|---|---|
FourierEffect |
Wrap a FourierBase component as a MuEffect |
LinearTrendEffect |
Wrap a LinearTrend component as a MuEffect |
EventAdditiveEffect |
Turn dated events into additive model effects |
Typical usage:
Event surfaces
Import path:
Main public event types:
| Type | Purpose |
|---|---|
EventEffect |
Event effect specification combining a basis and effect size prior |
GaussianBasis |
Symmetric Gaussian event basis |
HalfGaussianBasis |
One-sided Gaussian event basis |
AsymmetricGaussianBasis |
Gaussian basis with different pre and post widths |
You can use EventEffect either:
- directly with
PanelMMM.add_events(...), or - indirectly through
EventAdditiveEffect
Example: direct event attachment
Serialisation note
FourierEffect and LinearTrendEffect participate in the PanelMMM
round-trip path.
EventAdditiveEffect does not currently round-trip through
PanelMMM.load(...), because the original event DataFrame is not serialised.