-
Notifications
You must be signed in to change notification settings - Fork 21
Home
Welcome to the smooth package wiki! The smooth package implements Single Source of Error (SSOE) state-space models for forecasting and time series analysis, available for both R and Python (under development).
| Function | Description | Python | R |
|---|---|---|---|
| ADAM | Augmented Dynamic Adaptive Model - unified ETS/ARIMA/regression framework | Yes | Yes |
| AutoADAM | Automatic ADAM with distribution and ARIMA order selection | Yes | Yes |
| ES | Exponential Smoothing (ETS) wrapper for ADAM | Yes | Yes |
| CES | Complex Exponential Smoothing | TBA | Yes |
| SSARIMA | State Space ARIMA | TBA | Yes |
| MSARIMA | Multiple Seasonal ARIMA (fixed orders) and automatic selection (AutoMSARIMA) | Yes | Yes |
| GUM | Generalised Univariate Model | TBA | Yes |
| SMA | Simple Moving Average | TBA | Yes |
| OES | Occurrence ETS for intermittent demand | TBA | Yes |
| Function | Description | Python | R |
|---|---|---|---|
| msdecompose | Multiple seasonal decomposition (used for ADAM/ES initialization) | Yes | Yes |
| lowess | Scatter plot smoothing from Cleveland, W. S. (1979) | Yes | in stats package |
lowess was implemented in Python to exactly reproduce R's stats::lowess behaviour. The implementation is written in C++ based on R's original C code, producing identical results while running faster than other Python implementations.
See Installation for details.
from smooth import ADAM, AutoADAM, ES, msdecompose
# Automatic ETS model selection
model = ADAM(model="ZXZ", lags=12)
model.fit(y)
forecasts = model.predict(h=12)
# Automatic distribution and ARIMA selection
model = AutoADAM(model="ZZZ", lags=[1, 12],
orders={"ar": 2, "i": 2, "ma": 2})
model.fit(y)
# Simple Exponential Smoothing
model = ES(model="ZXZ")
model.fit(y)
# Time series decomposition
result = msdecompose(y, lags=[12], type='additive')library(smooth)
# Automatic model selection
model <- adam(y, model="ZXZ", lags=12)
forecast(model, h=12)
# Automatic distribution and ARIMA selection
model <- auto.adam(y, model="ZZZ",
orders=list(ar=2, i=2, ma=2, select=TRUE),
distribution=c("dnorm","dlaplace","ds"))
# Exponential Smoothing
model <- es(y, model="ZXZ", h=12)ADAM is the recommended function for most forecasting tasks. It provides:
- Unified ETS and ARIMA framework
- Multiple seasonality support
- Various error distributions
- Intermittent demand handling
- External regressors
- Automatic model selection
- ... and more
These pages document parameters shared across multiple functions:
-
Model-Specification - The
modelparameter, ETS taxonomy, and model type methods -
Orders-and-Lags - ARIMA
ordersand seasonallags - Loss-Functions - Loss functions for estimation (MSE, MAE, likelihood, etc.)
-
Explanatory-Variables - External regressors via
formula/xreg(R) andXargument (Python) -
Initialisation - The
initialparameter and state initialization -
Persistence - Smoothing parameters (alpha, beta, gamma) and
phi - Bounds - Parameter bounds and stability restrictions
- Visualisation-and-Output - plot(), print(), summary(), xtable()
- Coefficients-and-Parameters - coef(), confint(), vcov(), coefbootstrap()
- Fitted-Values-and-Forecasts - fitted(), actuals(), predict(), forecast()
- Residuals-and-Errors - residuals(), rstandard(), rmultistep(), outlierdummy()
- Likelihood-and-Information-Criteria - logLik(), AIC(), BIC(), accuracy(), pls()
- Model-Information - nobs(), nparam(), sigma(), extractScale()
- Simulation-Functions - simulate(), sim.es(), sim.ssarima(), sim.ces(), sim.gum(), sim.sma()
- Refitting-and-Reforecasting - reapply(), reforecast()
- Scale-Model - sm() for modelling heteroscedasticity
| Model | R | Python |
|---|---|---|
| ADAM | adam() | ADAM |
| AutoADAM | auto.adam() | AutoADAM |
| ES | es() | ES |
| CES | ces() | TBA |
| GUM | gum() | TBA |
| SSARIMA | ssarima() | TBA |
| MSARIMA | msarima() | MSARIMA |
| MSARIMA | auto.msarima() | AutoMSARIMA |
| SMA | sma() | TBA |
| OES | oes() | TBA |
| msdecompose | msdecompose() | msdecompose() |
| lowess | stats::lowess() | lowess() |
| Functionality | Description | Wiki |
|---|---|---|
| Estimate ETS | Estimate a specific type of ETS model | ADAM, ES |
| Default selection | Select the best model from an automatically created pool | ADAM, ES |
| Selection from a pool | Select the best model from the defined pool | ADAM, ES |
| Combination | AIC-weighted combination of forecasts | ADAM, ES |
| Combination from a pool | AIC-weighted combination of forecasts from the pool of models | ADAM, ES |
| ADAMX (fixed regressors) | ADAM/ETS/ARIMA with external regressors (fixed coefficients) | Explanatory-Variables |
| ADAMX (selection) | ADAM/ETS/ARIMA with automatic stepwise regressor selection | Explanatory-Variables |
| ADAMX (adaptive) | ADAM/ETS/ARIMA with time-varying regressor coefficients | Explanatory-Variables |
| Multiple seasonal ETS | ETS with multiple seasonal patterns (e.g. daily + weekly) | ADAM, ES |
| Point forecasts | Generate mean or median point forecasts | Fitted-Values-and-Forecasts |
| Prediction intervals | Construct intervals via analytical, simulated, or semiparametric methods | Fitted-Values-and-Forecasts |
| Cumulative forecasts | Aggregate forecasts over the horizon (e.g. total demand over lead time) | Fitted-Values-and-Forecasts |
| ARIMA (fixed orders) | Estimate a pure ARIMA model with specified orders | MSARIMA, ADAM |
| ARIMA (automatic selection) | Select optimal AR/I/MA orders using information criteria | AutoADAM, MSARIMA |
| Multiple seasonal ARIMA | ARIMA with multiple seasonal patterns | MSARIMA, ADAM |
| ETS + ARIMA | Combine ETS and ARIMA components in a single model | ADAM, AutoADAM |
| Advanced loss functions | Estimate using MSE, MAE, likelihood, HAM, and other loss functions | Loss-Functions |
| Distribution (fixed) | Estimate model with a specified error distribution | ADAM, ES |
| Distribution (automatic) | Select the best error distribution using information criteria | AutoADAM |
| Outlier detection (use) | Detect outliers and include all as dummy regressors | AutoADAM, ADAM |
| Outlier detection (select) | Detect outliers and select significant ones via stepwise | AutoADAM, ADAM |
| Occurrence model | Model the probability of non-zero demand (intermittent series); R only, Python TBA | OES |
| Scale model | Model heteroscedasticity via a separate scale equation; R only, Python TBA | Scale-Model |
| Model diagnostics via plots | Diagnostic plots (residuals, ACF, states, etc.); R only, Python TBA | Visualisation-and-Output |
| Multi-step forecast errors | Extract and analyse multi-step forecast errors via rmultistep(); R only, Python TBA |
Residuals-and-Errors |
Fitting and Forecasting:
| Method | R | Python | Description |
|---|---|---|---|
| fit | adam() | .fit() | Fit the model |
| predict | forecast() / predict() | .predict() | Generate forecasts |
| fitted | fitted() | .fitted | Fitted values |
| actuals | actuals() | .actuals | Original data |
| simulate | simulate() | TBA | Simulate from model |
Output and Visualisation:
| Method | R | Python | Description |
|---|---|---|---|
| summary | summary() | TBA | Model summary with confidence intervals etc |
| print() | print() | Basic output | |
| plot | plot() | TBA | Diagnostic plots |
| xtable | xtable() | TBA | LaTeX tables |
Coefficients and Parameters:
| Method | R | Python | Description |
|---|---|---|---|
| coef | coef() | .coef | Extract coefficients |
| confint | confint() | TBA | Confidence intervals |
| vcov | vcov() | TBA | Variance-covariance matrix |
| coefbootstrap | coefbootstrap() | TBA | Bootstrap coefficients |
Residuals and Errors:
| Method | R | Python | Description |
|---|---|---|---|
| residuals | residuals() | .residuals | Model residuals |
| rstandard | rstandard() | .rstandard() | Standardised residuals |
| rstudent | rstudent() | .rstudent() | Studentised residuals |
| rmultistep | rmultistep() | TBA | Multi-step forecast errors |
| multicov | multicov() | TBA | Multi-step error covariance |
| outlierdummy | outlierdummy() | .outlierdummy() | Outlier dummy variables |
Likelihood and Information Criteria:
| Method | R | Python | Description |
|---|---|---|---|
| logLik | logLik() | .loglik | Log-likelihood |
| pointLik | pointLik() | TBA | Point log-likelihoods per observation |
| AIC / BIC | AIC() / BIC() | .aic / .bic | Information criteria |
| AICc / BICc | AICc() / BICc() | .aicc / .bicc | Corrected IC |
| pAIC / pBIC | pAIC() / pBIC() | TBA | Point information criteria |
| accuracy | accuracy() | TBA | Forecast accuracy measures |
Model Information:
| Method | R | Python | Description |
|---|---|---|---|
| nobs | nobs() | .nobs | Number of observations |
| nparam | nparam() | .nparam | Number of parameters |
| sigma | sigma() | .sigma | Residual standard deviation |
| extractScale | extractScale() | TBA | Scale parameter (time-varying if sm used) |
| errorType | errorType() | .error_type | Error type (A/M) |
| modelType | modelType() | .model_type | Model specification |
| modelName | modelName() | .model_name | Full model name |
| orders | orders() | .orders | ARIMA orders |
| lags | lags() | .lags | Model lags |
Advanced Methods:
| Method | R | Python | Description |
|---|---|---|---|
| reapply | reapply() | TBA | Refit with perturbed parameters |
| reforecast | reforecast() | TBA | Forecast with parameter uncertainty |
| sm | sm() | TBA | Scale model (heteroscedasticity) |
| implant | implant() | TBA | Merge location and scale models |
Simulation Functions:
| Method | R | Python | Description |
|---|---|---|---|
| sim.es | sim.es() | TBA | Simulate from ETS models |
| sim.ssarima | sim.ssarima() | TBA | Simulate from ARIMA models |
| sim.ces | sim.ces() | TBA | Simulate from CES models |
| sim.gum | sim.gum() | TBA | Simulate from GUM models |
| sim.sma | sim.sma() | TBA | Simulate from SMA models |
| sim.oes | sim.oes() | TBA | Simulate occurrence probabilities |
- Installation - Installation instructions and troubleshooting
- Model-Estimation - Optimisation and estimation parameters
- Resources - Publications and DOIs for each function