NumberRollingColumn extends RollingColumn { public DoubleColumn mean() { return (DoubleColumn) calc(AggregateFunctions.mean); } NumberRollingColumn(NumericColumn<?> column, int window); DoubleColumn mean(); DoubleColumn median(); DoubleColumn geometricMean(); DoubleColumn sum(); DoubleColumn min(); DoubleColumn max(); DoubleColumn countMissing(); DoubleColumn countNonMissing(); DoubleColumn stdDev(); DoubleColumn variance(); DoubleColumn skewness(); DoubleColumn kurtosis();  }
@Test public void testRollingMean() { double[] data = new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; double missing = DoubleColumnType.missingValueIndicator(); double[] sma5 = new double[] {missing, missing, missing, missing, 3, 4, 5, 6, 7, 8}; DoubleColumn result = DoubleColumn.create("data", data).rolling(5).mean(); assertArrayEquals(sma5, result.asDoubleArray(), 0.000001); assertEquals("data 5-period Mean", result.name()); }