Search in sources :

Example 1 with ArimaForecaster

use of org.espy.arima.ArimaForecaster in project bamboobsc by billchen198318.

the class TimeSeriesAnalysisUtils method getForecastNext.

public static double[] getForecastNext(TsaVO tsa, double[] observations) throws ServiceException, Exception {
    if (null == observations || observations.length < 1) {
        throw new IllegalArgumentException("observations array cannot zero size");
    }
    List<BbTsaMaCoefficients> coefficients = getCoefficients(tsa);
    if (coefficients == null || coefficients.size() != 3) {
        throw new IllegalStateException("Ma coefficients data error");
    }
    DefaultArimaProcess arimaProcess = new DefaultArimaProcess();
    arimaProcess.setMaCoefficients(coefficients.get(0).getSeqValue(), coefficients.get(1).getSeqValue(), coefficients.get(2).getSeqValue());
    arimaProcess.setIntegrationOrder(tsa.getIntegrationOrder());
    ArimaForecaster arimaForecaster = new DefaultArimaForecaster(arimaProcess, observations);
    double[] forecast = arimaForecaster.next(tsa.getForecastNext());
    return forecast;
}
Also used : DefaultArimaForecaster(org.espy.arima.DefaultArimaForecaster) DefaultArimaProcess(org.espy.arima.DefaultArimaProcess) BbTsaMaCoefficients(com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients) DefaultArimaForecaster(org.espy.arima.DefaultArimaForecaster) ArimaForecaster(org.espy.arima.ArimaForecaster)

Example 2 with ArimaForecaster

use of org.espy.arima.ArimaForecaster in project bamboobsc by billchen198318.

the class DefaultArimaForecasterTest method test.

@Test
public void test() {
    DefaultArimaProcess arimaProcess = new DefaultArimaProcess();
    arimaProcess.setMaCoefficients(0.7, -0.3, 0.1);
    arimaProcess.setIntegrationOrder(1);
    double[] observations = new double[] { -0.262502, -1.18863, -0.874338, 0.587444, 1.37453, 1.8149, 1.87319, 1.32972, 2.13976, 4.93046, 5.24314, 3.38584, 3.1152, 2.84794, 1.04411, 1.5423, 1.85116, 0.968863, -0.173814, -3.43235 };
    ArimaForecaster arimaForecaster = new DefaultArimaForecaster(arimaProcess, observations);
    double[] forecast = arimaForecaster.next(5);
    System.out.println("Forecast: " + Arrays.toString(forecast));
}
Also used : DefaultArimaForecaster(org.espy.arima.DefaultArimaForecaster) DefaultArimaProcess(org.espy.arima.DefaultArimaProcess) DefaultArimaForecaster(org.espy.arima.DefaultArimaForecaster) ArimaForecaster(org.espy.arima.ArimaForecaster) Test(org.junit.Test)

Example 3 with ArimaForecaster

use of org.espy.arima.ArimaForecaster in project bamboobsc by billchen198318.

the class DefaultArimaForecasterTest method test2.

@Test
public void test2() {
    DefaultArimaProcess arimaProcess = new DefaultArimaProcess();
    arimaProcess.setMaCoefficients(0.05, 0.3, -0.25);
    arimaProcess.setIntegrationOrder(1);
    double[] observations = new double[] { 56.7, 63.5, 71.5, 65.1 };
    ArimaForecaster arimaForecaster = new DefaultArimaForecaster(arimaProcess, observations);
    double[] forecast = arimaForecaster.next(5);
    System.out.println("Forecast: " + Arrays.toString(forecast));
}
Also used : DefaultArimaForecaster(org.espy.arima.DefaultArimaForecaster) DefaultArimaProcess(org.espy.arima.DefaultArimaProcess) DefaultArimaForecaster(org.espy.arima.DefaultArimaForecaster) ArimaForecaster(org.espy.arima.ArimaForecaster) Test(org.junit.Test)

Aggregations

ArimaForecaster (org.espy.arima.ArimaForecaster)3 DefaultArimaForecaster (org.espy.arima.DefaultArimaForecaster)3 DefaultArimaProcess (org.espy.arima.DefaultArimaProcess)3 Test (org.junit.Test)2 BbTsaMaCoefficients (com.netsteadfast.greenstep.po.hbm.BbTsaMaCoefficients)1