public class ARMAForecast extends Object
IntTimeTimeSeries; the first observation has time index one.ARMAModel, or use the order-based constructor to fit
an ARMA(p,q) model with CSS. That constructor does not select p or q.next(int). The returned Java list
uses zero-based indices; the first forecast time is sample size plus one.This is a stateful horizon iterator over a fixed observation history.
Calling next(2) and then next() returns horizons one and two,
then horizon three. It does not assimilate either actual observations or the
previous prediction as a newly observed value. For a rolling forecast, construct
a new forecaster with the newly extended history; do not mutate the old history
while its forecaster is in use. Use independent instances for independent streams.
Check forecast values for finiteness. This example uses unit innovation variance;
see the scaling note on ARMAForecastMultiStep before interpreting error
variances for a non-unit model.
With coefficient one half and zero intercept, each additional point forecast halves the last known value. These are conditional forecasts for a fixed model, not a fitted trading strategy.
import dev.nm.stat.timeseries.datastructure.univariate.realtime.inttime.SimpleTimeSeries;
import dev.nm.stat.timeseries.linear.univariate.stationaryprocess.arma.ARMAModel;
import dev.nm.stat.timeseries.linear.univariate.stationaryprocess.arma.ARMAForecast;
import dev.nm.stat.timeseries.linear.univariate.arima.ARIMAForecast.Forecast;
import java.util.List;
ARMAModel model = new ARMAModel(new double[]{0.5}, null);
ARMAForecast forecast = new ARMAForecast(new SimpleTimeSeries(new double[]{1, 2, 3, 4}), model);
List<Forecast> firstTwo = forecast.next(2);
assert firstTwo.size() == 2;
assert firstTwo.get(0).time() == 5;
assert Math.abs(firstTwo.get(0).xHat() - 2) < 1e-10;
assert Math.abs(firstTwo.get(1).xHat() - 1) < 1e-10;
Forecast third = forecast.next();
assert third.time() == 7;
assert Math.abs(third.xHat() - 0.5) < 1e-10;
assert Math.abs(firstTwo.get(0).var() - 1) < 1e-10;
| Constructor and Description |
|---|
ARMAForecast(IntTimeTimeSeries xt,
ARMAModel arma)
Constructs a forecaster for a time series assuming ARMA model.
|
ARMAForecast(IntTimeTimeSeries xt,
int p,
int q)
Constructs a forecaster for a time series assuming ARMA model.
|
| Modifier and Type | Method and Description |
|---|---|
ARIMAForecast.Forecast |
next()
Gets the next forecast.
|
List<ARIMAForecast.Forecast> |
next(int nSteps)
Gets the next n-step forecasts.
|
public ARMAForecast(IntTimeTimeSeries xt, ARMAModel arma)
xt - a time seriesarma - the ARMA specificationpublic ARMAForecast(IntTimeTimeSeries xt, int p, int q)
xt - a time seriesp - the number of AR termsq - the number of MA termspublic ARIMAForecast.Forecast next()
public List<ARIMAForecast.Forecast> next(int nSteps)
nSteps - the number of steps to forecastCopyright © 2010-2026 NM Group. All Rights Reserved.