Skip to content

Fitted Values and Forecasts

Ivan Svetunkov edited this page Jan 30, 2026 · 19 revisions

Fitted Values and Forecasts

This page documents methods for extracting fitted values and generating forecasts from smooth models.

predict()/forecast()

Generates point forecasts and optionally prediction intervals for h steps ahead.

In R, the standard method is forecast(), although predict() is also available, but with a limited functionality and focusing on the in-sample prediction.

In Python, use predict() method.

R Usage

model <- adam(AirPassengers, "MMM", lags=12)

# Out-of-sample prediction
pred <- forecast(model, h=12, interval="prediction")

# In-sample confidence intervals
pred <- predict(model, interval="confidence")

Python Usage

from smooth import ADAM

# Fit model
model = ADAM(model="ZZZ", lags=12)
model.fit(y)

# Basic point forecast
forecasts = model.predict(h=12)

# With prediction intervals (parametric)
forecasts = model.predict(
    h=12,
    calculate_intervals=True,
    interval_method='parametric',
    level=0.95
)

# Simulation-based intervals
forecasts = model.predict(
    h=12,
    calculate_intervals=True,
    interval_method='simulation',
    level=[0.8, 0.95],
    nsim=1000
)

# One-sided intervals
forecasts = model.predict(
    h=12,
    calculate_intervals=True,
    interval_method='parametric',
    level=0.95,
    side='upper'
)

# Access prediction intervals after calling predict()
intervals = model.predict_intervals(h=12, levels=[0.8, 0.95])

Parameters

Parameter Type (R) Type (Python) Default Description
object adam ADAM - Fitted model
h integer int 10 Forecast horizon
newdata matrix/data.frame - NULL New explanatory variables for forecasting
X - NDArray None Exogenous variables for forecast period
occurrence numeric vector - NULL Future occurrence probabilities (values in [0,1]) if known
calculate_intervals - bool True Whether to calculate prediction intervals
interval character - "none" Interval type (see table below)
interval_method - str "parametric" Method: "parametric", "simulation", or "bootstrap"
level numeric float/list 0.95 Confidence level(s)
side character str "both" Interval side: "both", "upper", "lower"
cumulative logical - FALSE Produce cumulative forecasts (useful for inventory control)
nsim integer int NULL Number of simulations.
scenarios logical - FALSE Return simulated scenarios (only for interval="simulated")
... - - - Other parameters passed to underlying functions

Interval Types

Type Description Best For
"none" No intervals Point forecasts only
"prediction" Analytical for additive, simulated for others General use (recommended)
"approximate" / "parametric" Analytical formulae for conditional variance Fast, additive models
"semiparametric" Based on multi-step forecast errors and assumed distribution When residuals are not i.i.d.
"nonparametric" Quantile regression (Taylor & Bunn, 1999) Distribution-free
"empirical" Empirical quantiles of multi-step forecast errors Distribution and model free
"simulated" Monte Carlo simulation Multiplicative models
"confidence" Confidence intervals for point forecast via reforecast() Uncertainty in the forecast line
"complete" Accounts for parameter uncertainty via reforecast() Full uncertainty quantification

Note: "semiparametric", "nonparametric" and "empirical" use the rmultistep() method to extract multistep in-sample forecast errors. See more in Residuals-and-Errors.

Output

R: Returns an object of class "adam.forecast".

Python: Returns a NumPy array of point forecasts. Prediction intervals are stored in model.forecast_results and can be accessed via model.predict_intervals().

Returns an object of class "smooth.forecast" containing:

Element Description
model The estimated model
mean Point forecasts (conditional mean)
lower Lower prediction bounds
upper Upper prediction bounds
level Confidence level(s) used
interval Whether intervals were produced (logical)
scenarios Matrix of simulated scenarios (if scenarios=TRUE and interval="simulated")

fitted()

Extracts fitted (in-sample predicted) values from the model.

Note: In Python, access fitted values via model.prepared_model['y_fitted'].

R Usage

model <- adam(AirPassengers, "MMM", lags=12)

# Get fitted values
fitted(model)

Python Usage

from smooth import ADAM
import numpy as np

model = ADAM(model="MMM", lags=12)
model.fit(y)

# Get fitted values
print(model.prepared_model['y_fitted'])

Output

Returns a time series/array with fitted values for each in-sample observation.

actuals()

Extracts the actual (observed) values used in model estimation.

Note: In Python, access actuals via model.data or the original data passed to fit().

R Usage

model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)

# Get actuals
y <- actuals(model)

Python Usage

from smooth import ADAM

model = ADAM(model="MMM", lags=12)
model.fit(y)

# Get actuals (the data used for fitting)
actuals = model.data

See Also

Clone this wiki locally