public class ConditionalSumOfSquares extends Object implements ARMAFit
arima.
Supply finite observations in chronological order and nonnegative p, d, q. Choose d before fitting and retain enough observations after differencing to identify the requested model. The constructor fits immediately using a numerical optimizer; the iteration limit is not a convergence certificate.
getModel() returns the fitted ARIMA model, including its supplied
differencing order. getARMAModel() extracts the stationary ARMA part:
when d is nonzero it must not be applied directly to the original undifferenced
levels. Use ARIMAForecast with the original history and getModel()
in that case. For d = 0, ARMAForecast is sufficient.
Inspect fitted coefficients and var() for finite values, check
stationarity/invertibility and residual behavior independently, and compare
forecasts on held-out observations. No automatic data cleaning or order search
is performed by this fitter.
The synthetic observations below demonstrate the calling sequence. They are not market data, and the assertions check usable output rather than statistical model adequacy.
import dev.nm.stat.timeseries.datastructure.univariate.realtime.inttime.SimpleTimeSeries;
import dev.nm.stat.timeseries.linear.univariate.stationaryprocess.arma.ConditionalSumOfSquares;
import dev.nm.stat.timeseries.linear.univariate.stationaryprocess.arma.ARMAForecast;
import dev.nm.stat.timeseries.linear.univariate.arima.ARIMAForecast.Forecast;
double[] observed = new double[40];
for (int i = 1; i < observed.length; ++i) {
observed[i] = 0.6 * observed[i - 1] + Math.sin(1.7 * i) + 0.2 * Math.cos(0.3 * i);
}
ConditionalSumOfSquares fit = new ConditionalSumOfSquares(observed, 1, 0, 0, 500);
assert fit.getARMAModel().p() == 1;
assert fit.getModel().d() == 0;
assert Double.isFinite(fit.var()) && fit.var() > 0;
ARMAForecast predictor = new ARMAForecast(new SimpleTimeSeries(observed), fit.getARMAModel());
Forecast next = predictor.next();
assert next.time() == observed.length + 1;
assert Double.isFinite(next.xHat());
| Constructor and Description |
|---|
ConditionalSumOfSquares(double[] x,
int p,
int d,
int q)
Fit an ARIMA model for the observations using CSS.
|
ConditionalSumOfSquares(double[] x,
int p,
int d,
int q,
int maxIterations)
Fit an ARIMA model for the observations using CSS.
|
| Modifier and Type | Method and Description |
|---|---|
double |
AIC()
Compute the AIC, a model selection criterion.
|
double |
AICC()
Compute the AICC, a model selection criterion.
|
Matrix |
covariance()
Get the asymptotic covariance matrix of the estimated parameters,
φ and θ.
|
ARMAModel |
getARMAModel()
Get the fitted ARMA model.
|
ARIMAModel |
getModel()
Get the fitted ARIMA model.
|
int |
nParams()
Get the number of parameters for the estimation/fitting.
|
ImmutableVector |
stderr()
Get the asymptotic standard errors of the estimated parameters,
φ and θ.
|
String |
toString() |
double |
var()
Get the variance of the white noise.
|
public ConditionalSumOfSquares(double[] x,
int p,
int d,
int q,
int maxIterations)
d is taken as an input. If the
differenced input time series is not zero-mean, it is first de-mean-ed
before running the algorithm as in Brockwell and Davis. When reporting
the model, we compute the intercept to match the mean.x - the time series of observationsp - the number of AR termsd - the order of integrationq - the number of MA termsmaxIterations - the maximum number of iterationspublic ConditionalSumOfSquares(double[] x,
int p,
int d,
int q)
d is taken as an input. If the
differenced input time series is not zero-mean, it is first de-mean-ed
before running the algorithm as in Brockwell and Davis. When reporting
the model, we compute the intercept to match the mean.x - the time series of observationsp - the number of AR termsd - the order of integrationq - the number of MA termspublic int nParams()
public ARIMAModel getModel()
public ARMAModel getARMAModel()
public double var()
ARMAFitpublic Matrix covariance()
covariance in interface ARMAFitpublic ImmutableVector stderr()
public double AIC()
AIC in interface ARMAFitpublic double AICC()
Copyright © 2010-2026 NM Group. All Rights Reserved.