Skip to content

Fitted Values and Forecasts

Ivan Svetunkov edited this page Feb 11, 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 (no intervals by default, matching R)
forecasts = model.predict(h=12)

# With prediction intervals (auto-selects method)
forecasts = model.predict(h=12, interval="prediction", level=0.95)

# Approximate (parametric) intervals
forecasts = model.predict(h=12, interval="approximate", level=0.95)

# Simulation-based intervals
forecasts = model.predict(
    h=12, interval="simulated",
    level=0.95, nsim=1000
)

# Multiple confidence levels at once
forecasts = model.predict(h=12, interval="prediction", level=[0.8, 0.95, 0.99])

# One-sided intervals
forecasts = model.predict(h=12, interval="prediction", level=0.95, side="upper")
forecasts = model.predict(h=12, interval="prediction", level=0.95, side="lower")

# Convenience method for multi-level intervals
intervals = model.predict_intervals(h=12, levels=[0.8, 0.95])

Parameters

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

Interval Types

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

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

Level parameter

The level parameter specifies the confidence level(s) for prediction intervals. It can be a single value or (in both R and Python) a vector/list of values for producing multiple interval bands simultaneously.

Values above 1 are treated as percentages and automatically divided by 100 (e.g. level=95 becomes level=0.95).

Single level (scalar):

Language Code Output columns
R forecast(model, h=12, level=0.95) $lower and $upper (single-column matrices)
Python model.predict(h=12, interval="prediction", level=0.95) "lower_0.025", "upper_0.975"

Multiple levels (vector/list):

Language Code Output columns
R forecast(model, h=12, level=c(0.8, 0.95, 0.99)) $lower and $upper (3-column matrices)
Python model.predict(h=12, interval="prediction", level=[0.8, 0.95, 0.99]) "lower_0.1", "lower_0.025", "lower_0.005", "upper_0.9", "upper_0.975", "upper_0.995"

The Python column naming convention uses the quantile value: for side="both" and level=X, the lower column is lower_{(1-X)/2} and the upper column is upper_{(1+X)/2}.

Side parameter

The side parameter controls which bounds of the prediction interval are returned.

Value Description Python output columns (level=0.9)
"both" Both lower and upper bounds (default) "lower_0.05", "upper_0.95"
"upper" Upper bound only "upper_0.9"
"lower" Lower bound only "lower_0.1"

When side="upper", the upper quantile equals the level directly (e.g. 90th percentile for level=0.9). When side="lower", the lower quantile equals 1 - level (e.g. 10th percentile for level=0.9). Both side options work with single or multiple levels.

Output

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

Python: predict() returns a pandas DataFrame with a "mean" column and optional interval columns (e.g., "lower_0.025", "upper_0.975" for level=0.95) when interval is not "none". Multiple levels produce multiple column pairs.

Element Description R Python
model The estimated model object Yes -
mean Point forecasts (conditional mean) Yes Yes
lower Lower prediction bounds (matrix with columns per level) Yes Yes
upper Upper prediction bounds (matrix with columns per level) Yes Yes
level Confidence level(s) used Yes Yes
side Which side of intervals was requested Yes Yes
interval Whether intervals were produced (logical) Yes -
scenarios Matrix of simulated scenarios (h × nsim) Yes Yes

Notes:

  • In R, access elements via $ (e.g., fc$mean, fc$lower)
  • In both R and Python, scenarios is only populated when interval="simulated" and scenarios=TRUE/True

fitted()

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

R Usage

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

# Get fitted values
fitted(model)

Python Usage

from smooth import ADAM

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

# Get fitted values
fitted_values = model.fitted

Output

R: Returns a time series with fitted values for each in-sample observation.

Python: Returns an NDArray with fitted values for each in-sample observation.

actuals()

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

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.actuals

Output

R: Returns a time series with the actual in-sample observations.

Python: Returns an NDArray with the actual in-sample observations.

See Also

Clone this wiki locally