-
Notifications
You must be signed in to change notification settings - Fork 22
Refitting and Reforecasting
This page documents methods for understanding parameter uncertainty and generating prediction intervals that account for both parameter and future uncertainty. These methods work with objects returned by ADAM and related functions.
Note: Not yet implemented in Python.
Reapplies the model with randomly generated parameters based on the covariance matrix of the estimated parameters. This helps understand how parameter uncertainty affects fitted values.
library(smooth)
# Fit model
model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)
# Reapply with random parameters (100 paths)
reappliedModel <- reapply(model, nsim=100)
plot(reappliedModel)- Extracts the variance-covariance matrix of estimated parameters
- Generates random parameter sets from a multivariate normal distribution centered on estimates
- Refits the model with each parameter set
- Returns fitted paths for analysis
Read more about it in Section 16.5 of Svetunkov (2023).
| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
object |
adam | - | - | Fitted ADAM model |
nsim |
integer | - | 1000 | Number of simulation paths |
bootstrap |
logical | - | FALSE | Use bootstrap sampling instead of parametric to get covariance matrix of parameters |
heuristics |
logical | - | FALSE | Use heuristic bounds for parameters |
Returns a matrix with:
- Rows: Time points
- Columns: Simulation paths
model <- adam(AirPassengers, "AAN", h=12, holdout=TRUE)
# Generate 500 paths
reappliedModel <- reapply(model, nsim=500)
# Compute confidence intervals for fitted values
fitted_lower <- apply(reappliedModel, 1, quantile, probs=0.025)
fitted_upper <- apply(reappliedModel, 1, quantile, probs=0.975)
# Plot with uncertainty bands
plot(reappliedModel)Produces forecasts using randomly generated parameters (via reapply) combined with simulated future errors. This provides prediction intervals that account for both parameter uncertainty and future uncertainty. Can also generate confidence interval for the forecasts, i.e. showing uncertainty about the line itself (don't confuse with the prediction ones).
library(smooth)
# Fit model
model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)
# Generate forecasts
modelForecast <- reforecast(model, h=12, nsim=500)- Uses reapply to get model fits with different parameter sets
- For each parameter model fit, simulates future errors from the estimated distribution
- Produces forecast paths that incorporate both sources of uncertainty
- Returns matrix of forecast paths for constructing prediction intervals
| Parameter | Type (R) | Type (Python) | Default | Description |
|---|---|---|---|---|
object |
adam | - | - | Fitted ADAM model |
h |
integer | - | 10 | Forecast horizon |
nsim |
integer | - | 100 | Number of simulation paths. Also passed to reapply |
bootstrap |
logical | - | FALSE | Pass parameter to reapply |
heuristics |
logical | - | FALSE | Pass parameter to reapply |
Returns a matrix with:
- Rows: Forecast horizons (1 to h)
- Columns: Simulation paths
model <- adam(AirPassengers, "MMM", lags=12, h=12, holdout=TRUE)
# Generate forecasts
modelForecast <- reforecast(model, h=12, nsim=500, interval="prediction")
plot(modelForecast)| Method | Parameter Uncertainty | Future Uncertainty | Speed |
|---|---|---|---|
forecast(..., interval="parametric") |
No | Yes (assumed) | Fast |
forecast(..., interval="simulated") |
No | Yes (simulated) | Moderate |
reforecast() |
Yes | Yes | Slow |
Use reforecast() when:
- Parameter uncertainty is substantial (small samples, complex models)
- Parameters are close to zero
- You need the more calibrated prediction intervals than in case of the simple ones
- Computational time is not a constraint
- ADAM - Main ADAM function
- Simulation-Functions - Data simulation functions
- Fitted-Values-and-Forecasts - Standard forecast methods
- Scale-Model - Modelling heteroscedasticity