@Test public void testSimpleExponentialSmoothing() { logger.info("simpleExponentialSmoothing"); FlatDataList flatDataList = generateFlatDataList(); double a = 0.9; double expResult = 23.240433133179; double result = Smoothing.simpleExponentialSmoothing(flatDataList, a); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) { double EMA=0; int count=0; for(int i=flatDataList.size()-1;i>=0;--i) { double Yti = flatDataList.getDouble(i); EMA+=a*Math.pow(1-a,count)*Yti; ++count; } return EMA; }
Smoothing { public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) { double EMA=0; int count=0; for(int i=flatDataList.size()-1;i>=0;--i) { double Yti = flatDataList.getDouble(i); EMA+=a*Math.pow(1-a,count)*Yti; ++count; } return EMA; } }
Smoothing { public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) { double EMA=0; int count=0; for(int i=flatDataList.size()-1;i>=0;--i) { double Yti = flatDataList.getDouble(i); EMA+=a*Math.pow(1-a,count)*Yti; ++count; } return EMA; }  }
Smoothing { public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) { double EMA=0; int count=0; for(int i=flatDataList.size()-1;i>=0;--i) { double Yti = flatDataList.getDouble(i); EMA+=a*Math.pow(1-a,count)*Yti; ++count; } return EMA; }  static double simpleMovingAverage(FlatDataList flatDataList, int N); static double simpleMovingAverageQuick(double Yt, double YtminusN, double Ft, int N); static double weightedMovingAverage(FlatDataList flatDataList, int N); static double simpleExponentialSmoothing(FlatDataList flatDataList, double a); static double simpleExponentialSmoothingQuick(double Ytminus1, double Stminus1, double a); static double holtWintersSmoothing(FlatDataList flatDataList, int season_length, double alpha, double beta, double gamma, double dev_gamma); }
Smoothing { public static double simpleExponentialSmoothing(FlatDataList flatDataList, double a) { double EMA=0; int count=0; for(int i=flatDataList.size()-1;i>=0;--i) { double Yti = flatDataList.getDouble(i); EMA+=a*Math.pow(1-a,count)*Yti; ++count; } return EMA; }  static double simpleMovingAverage(FlatDataList flatDataList, int N); static double simpleMovingAverageQuick(double Yt, double YtminusN, double Ft, int N); static double weightedMovingAverage(FlatDataList flatDataList, int N); static double simpleExponentialSmoothing(FlatDataList flatDataList, double a); static double simpleExponentialSmoothingQuick(double Ytminus1, double Stminus1, double a); static double holtWintersSmoothing(FlatDataList flatDataList, int season_length, double alpha, double beta, double gamma, double dev_gamma);  }