FastArimaForecasts { public double[] forecasts(double[] data, int nf) { SsfData sd = new SsfData(data, null); return fcasts(sd, nf); } FastArimaForecasts(final IArimaModel model, boolean mean); double getSsqErr(); double getMean(); double[] forecasts(double[] data, int nf); double[] forecasts(IReadDataBlock data, int nf);  }
@Test public void testLinearProcess() { SarimaSpecification spec = new SarimaSpecification(12); spec.airline(); spec.setBP(1); SarimaModel arima = new SarimaModel(spec); arima.setBPhi(1, -.9); FastArimaForecasts fcasts = new FastArimaForecasts(arima, false); int N=12; double[] f1 = fcasts.forecasts(x1, N); double[] f2 = fcasts.forecasts(x2, N); double[] f3 = fcasts.forecasts(x3, N); for (int i = 0; i < N; ++i) { assertEquals(f3[i], f1[i] + f2[i], 1e-9); } N=60; f1 = fcasts.forecasts(x1, N); f2 = fcasts.forecasts(x2, N); f3 = fcasts.forecasts(x3, N); for (int i = 0; i < N; ++i) { assertEquals(f3[i], f1[i] + f2[i], 1e-9); } }
@Test public void testMean() { SarimaSpecification spec = new SarimaSpecification(12); spec.airline(); spec.setBP(1); spec.setBD(0); SarimaModel arima = new SarimaModel(spec); arima.setBPhi(1, -.9); FastArimaForecasts fcasts = new FastArimaForecasts(arima, true); double[] f1 = fcasts.forecasts(x1, 24); }
@Test public void testNoMean() { SarimaSpecification spec = new SarimaSpecification(12); spec.airline(); spec.setBP(1); SarimaModel arima = new SarimaModel(spec); arima.setBPhi(1, -.9); FastArimaForecasts fcasts = new FastArimaForecasts(arima, false); double[] f1 = fcasts.forecasts(x1, 24); }