R:
Python:
Python wheels on PyPI ship with PEP 740 attestations — SLSA Build Level 3 provenance, signed via Sigstore on the GitHub Actions runner that built them. Verifiable client-side with pypi-attestations.
The smooth package implements Single Source of Error (SSOE) state-space models for forecasting and time series analysis, available for both R and Python.
Both the R and Python versions of smooth depend on the greybox package for distributions, information criteria, and supporting utilities (in Python this also provides the LOWESS smoother). It is installed automatically with smooth.
R (CRAN):
install.packages("smooth")R (github):
if (!require("remotes")) install.packages("remotes")
remotes::install_github("openforecast-org/smooth")Python (PyPI):
pip install smoothPython (github, dev):
pip install "git+https://github.com/openforecast-org/smooth.git@master#subdirectory=python"For development versions and system requirements, see the Installation wiki page.
library(smooth)
# ADAM - the recommended function for most tasks
model <- adam(y, model="ZXZ", lags=12)
forecast(model, h=12)
# Exponential Smoothing
model <- es(y, model="ZXZ", lags=12)
# Automatic model selection for ETS+ARIMA and distributions
model <- auto.adam(y, model="ZZZ",
orders=list(ar=2, i=2, ma=2, select=TRUE))from smooth import ADAM, ES
# ADAM model
model = ADAM(model="ZXZ", lags=12)
model.fit(y)
model.predict(h=12)
# Exponential Smoothing
model = ES(model="ZXZ")
model.fit(y)tbats() in R and TBATS in Python implement TBATS (De Livera, Hyndman and Snyder, 2011) in ADAM's single source of error framework: an ETS level and trend, a trigonometric seasonality for each period, ARMA errors, all after a Box-Cox transform. The seasonal periods can be several and need not be integers (52.18 weeks in a year, 8766 hours), and the number of harmonics, the trend, the ARMA orders and the distribution are selected automatically. R and Python fit the same model to the same data.
library(smooth)
# Ten years of weekly data with a yearly cycle of 52.18 weeks
y <- ts(100 + 0.05*(1:520) + 10*sin(2*pi*(1:520)/52.18) + rnorm(520, 0, 2), frequency=52)
model <- tbats(y, lags=c(1, 52.18), h=52, holdout=TRUE)
model$model # TBATS(lambda, {p,q}, phi, <52.18,k>)
forecast(model, h=52, interval="prediction")import numpy as np
from smooth import TBATS
t = np.arange(1, 521)
y = 100 + 0.05 * t + 10 * np.sin(2 * np.pi * t / 52.18) + np.random.normal(0, 2, 520)
model = TBATS(lags=[1, 52.18], h=52, holdout=True).fit(y)
print(model.model_name)
fc = model.predict(h=52, interval="prediction")See the TBATS wiki page for the details.
Full documentation is available on the GitHub Wiki, including:
- ADAM - Main unified ETS/ARIMA framework
- Function reference - All functions and methods
- Installation guide - Dependencies and troubleshooting
Book: Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). Chapman and Hall/CRC. Online: https://openforecast.org/adam/
smooth is developed and maintained by OpenForecast, a demand forecasting and inventory management consultancy. The package implements the methods we use in our consulting and teach in our training courses.

