public static Model fit(final double[] data, final double alpha, final double beta) {
        validateParams(alpha, beta);                        //validating values of alpha and beta

        double[] smoothedData = new double[data.length];    //array to store smoothed values

        double[] trends = new double[data.length + 1];
        double[] levels = new double[data.length + 1];

        //initializing values of parameters
        smoothedData[0] = data[0];
        trends[0] = data[1] - data[0];
        levels[0] = data[0];

        for (int t = 0 ; t < data.length ; t++) {
            smoothedData[t] = trends[t] + levels[t];
            levels[t + 1] = alpha * data[t] + (1 - alpha) * (levels[t] + trends[t]);
            trends[t + 1] = beta * (levels[t + 1] - levels[t]) + (1 - beta) * trends[t];
        }
        return new Model(smoothedData, trends, levels, calculateSSE(data, smoothedData));
    }
Performs double exponential smoothing for given time series.
This method is suitable for fitting series with linear trend.

@param data  An array containing the recorded data of the time series
@param alpha Smoothing factor for data (0 &lt; alpha &lt; 1)
@param beta  Smoothing factor for trend (0 &lt; beta &lt; 1)

@return Instance of model that can be used to forecast future values
src/main/java/eu/hansolo/tilesfx/tools/DoubleExponentialSmoothingForLinearSeries.java