public static TimeSeries getForecastData(TimeSeries observationData, int forcastperc) { TimeSeries fcdataset = new TimeSeries("Time Series Forecast"); if (observationData.isEmpty() == true) return fcdataset; int size = observationData.getItemCount(); long fcsize = size + Math.round( (double)size * ((double)forcastperc/100)); // new data set try { fcdataset = observationData.createCopy(0,size-1); for (int i=size; i < fcsize; i++) { RegularTimePeriod nexttp = fcdataset.getNextTimePeriod(); fcdataset.add(nexttp,0.00D); } } catch (Exception e) { System.out.println("Exception:" + e.getLocalizedMessage()); System.out.println("Could not create forecasted data sample"); return fcdataset; } return fcdataset; }
return createCopy(startIndex, endIndex);
return copy; return createCopy(startIndex, endIndex);