Permalink
Browse files

Converted ints to long

  • Loading branch information...
1 parent 2b89a04 commit 5cdb7a46572f12f3cbe3b379b1f32e528f5c6af2 @nchandra committed May 7, 2012
Showing with 8 additions and 8 deletions.
  1. +7 −7 src/main/java/com/nc/tsa/HoltWinters.java
  2. +1 −1 src/test/java/com/nc/tsa/TestHoltWinters.java
@@ -61,7 +61,7 @@
* @param debug - Print debug values. Useful for testing.
*
*/
- public static double[] forecast(int[] y, double alpha, double beta,
+ public static double[] forecast(long[] y, double alpha, double beta,
double gamma, int period, int m, boolean debug) {
validateArguments(y, alpha, beta, gamma, period, m);
@@ -91,7 +91,7 @@
return forecast;
}
- public static double[] forecast(int[] y, double alpha, double beta,
+ public static double[] forecast(long[] y, double alpha, double beta,
double gamma, int period, int m) {
return forecast(y, alpha, beta, gamma, period, m, false);
}
@@ -105,7 +105,7 @@
* @param gamma
* @param m
*/
- private static void validateArguments(int[] y, double alpha, double beta,
+ private static void validateArguments(long[] y, double alpha, double beta,
double gamma, int period, int m) {
if (y == null) {
throw new IllegalArgumentException("Value of y should be not null");
@@ -147,7 +147,7 @@ private static void validateArguments(int[] y, double alpha, double beta,
* @param debug
* @return - Forecast for m periods.
*/
- private static double[] calculateHoltWinters(int[] y, double a0, double b0,
+ private static double[] calculateHoltWinters(long[] y, double a0, double b0,
double alpha, double beta, double gamma,
double[] initialSeasonalIndices, int period, int m, boolean debug) {
@@ -204,7 +204,7 @@ private static void validateArguments(int[] y, double alpha, double beta,
*
* @return - Initial Level value i.e. St[1]
*/
- private static double calculateInitialLevel(int[] y) {
+ private static double calculateInitialLevel(long[] y) {
return y[0];
}
@@ -213,7 +213,7 @@ private static double calculateInitialLevel(int[] y) {
*
* @return - Initial trend - Bt[1]
*/
- private static double calculateInitialTrend(int[] y, int period) {
+ private static double calculateInitialTrend(long[] y, int period) {
double sum = 0;
@@ -229,7 +229,7 @@ private static double calculateInitialTrend(int[] y, int period) {
*
* @return - Seasonal Indices.
*/
- private static double[] calculateSeasonalIndices(int[] y, int period,
+ private static double[] calculateSeasonalIndices(long[] y, int period,
int seasons) {
double[] seasonalAverage = new double[seasons];
@@ -12,7 +12,7 @@ public void forecastNISTData() {
* NIST data available at:
* http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc436.htm
*/
- int[] y = { 362, 385, 432, 341, 382, 409, 498, 387, 473, 513, 582, 474,
+ long[] y = { 362, 385, 432, 341, 382, 409, 498, 387, 473, 513, 582, 474,
544, 582, 681, 557, 628, 707, 773, 592, 627, 725, 854, 661 };
int period = 4;
int m = 4;

0 comments on commit 5cdb7a4

Please sign in to comment.