Interface IsRegression

    • Method Detail

      • checkIfValid

        static void checkIfValid​(IsRegression regression)
        Checks if regression passed as argument is not null and if consistent as well.
        If not, throw a IllegalArgumentException.
        Parameters:
        regression - regression to be checked
      • checkAndGetIfValid

        static <T extends IsRegression> T checkAndGetIfValid​(T regression)
        Checks if regression passed as argument is not null and if consistent as well.
        If not, throw a IllegalArgumentException, otherwise it returns the regression.
        Type Parameters:
        T - type of regression
        Parameters:
        regression - regression to be checked
        Returns:
        the same regression passed as argument
      • getType

        RegressionType getType()
        Returns the regression type.
        Returns:
        the regression type
      • getDescriptor

        RegressionDescriptor getDescriptor()
        Returns the regression descriptor.
        Returns:
        the regression descriptor
      • getCoefficients

        List<Double> getCoefficients()
        Returns all calculated coefficients as a list.
        Returns:
        all calculated coefficients as a list
      • isConsistent

        boolean isConsistent()
        Returns true if the regression is consistent and usable.
        Returns:
        true if the regression is consistent and usable
      • predict

        double predict​(double x)
        Returns the Y value, calculated by the regression formula at specific X value.
        Parameters:
        x - value to use to get the predicted value
        Returns:
        the Y value, calculated by the regression formula at specific X value
      • predict

        double predict​(Date x)
        Returns the Y value, calculated by the regression formula at specific X value.
        Parameters:
        x - value to use to get the predicted value
        Returns:
        the Y value, calculated by the regression formula at specific X value
      • predict

        double predict​(DataPoint dataPoint)
        Returns the Y value, calculated by the regression formula at specific X value.
        Parameters:
        dataPoint - value to use to get the predicted value
        Returns:
        the Y value, calculated by the regression formula at specific X value
      • predict

        double predict​(TimeSeriesItem item)
        Returns the Y value, calculated by the regression formula at specific X value.
        Parameters:
        item - value to use to get the predicted value
        Returns:
        the Y value, calculated by the regression formula at specific X value
      • predict

        List<Double> predict​(double... xValues)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        xValues - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predict

        List<Double> predict​(List<Double> xValues)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        xValues - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predictByDates

        List<Double> predictByDates​(Date... xValues)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        xValues - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predictByDates

        List<Double> predictByDates​(List<Date> xValues)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        xValues - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predictByDataPoints

        List<Double> predictByDataPoints​(DataPoint... dataPoints)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        dataPoints - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predictByDataPoints

        List<Double> predictByDataPoints​(List<DataPoint> dataPoints)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        dataPoints - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predictByTimeSeriesItems

        List<Double> predictByTimeSeriesItems​(TimeSeriesItem... items)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        items - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • predictByTimeSeriesItems

        List<Double> predictByTimeSeriesItems​(List<TimeSeriesItem> items)
        Returns a list of Y values, calculated by the regression formula for specific X values.
        Parameters:
        items - values to use to get the predicted values
        Returns:
        a list of Y values, calculated by the regression formula for specific X values
      • score

        RegressionScore score​(List<Double> y)
        Evaluates the regression formula if the model fits enough.
        X values are creating starting from 0 with increment of 1.
        Parameters:
        y - Y values to use for evaluation
        Returns:
        the score of the regression
      • score

        RegressionScore score​(List<Double> y,
                              double starting)
        Evaluates the regression formula if the model fits enough.
        X values are creating starting from passed argument with increment of 1.
        Parameters:
        y - Y values to use for evaluation
        starting - starting value to create X values
        Returns:
        the score of the regression
      • score

        RegressionScore score​(List<Double> y,
                              double starting,
                              double increment)
        Evaluates the regression formula if the model fits enough.
        X values are creating starting from passed argument with increment of passed argument.
        Parameters:
        y - Y values to use for evaluation
        starting - starting value to create X values
        increment - increment to apply to the starting value
        Returns:
        the score of the regression
      • score

        RegressionScore score​(List<Double> x,
                              List<Double> y)
        Evaluates the regression formula if the model fits enough.
        Parameters:
        x - X values to use for evaluation
        y - Y values to use for evaluation
        Returns:
        the score of the regression
      • scoreByDate

        RegressionScore scoreByDate​(List<Date> x,
                                    List<Double> y)
        Evaluates the regression formula if the model fits enough.
        Parameters:
        x - X values to use for evaluation
        y - Y values to use for evaluation
        Returns:
        the score of the regression
      • scoreByDataPoints

        RegressionScore scoreByDataPoints​(List<DataPoint> dataPoints)
        Evaluates the regression formula if the model fits enough.
        Parameters:
        dataPoints - X and Y values to use for evaluation
        Returns:
        the score of the regression
      • scoreByTimeSeriesItems

        RegressionScore scoreByTimeSeriesItems​(List<TimeSeriesItem> items)
        Evaluates the regression formula if the model fits enough.
        Parameters:
        items - X and Y values to use for evaluation
        Returns:
        the score of the regression
      • toFormula

        String toFormula()
        Returns the formula of the regression.
        Returns:
        the formula of the regression
      • toFormula

        String toFormula​(int precision)
        Returns the formula of the regression, using the requested precision.
        Parameters:
        precision - precision to apply to the numbers of the formula
        Returns:
        the formula of the regression
      • toLaTeX

        String toLaTeX()
        Returns the formula of the regression.
        Returns:
        the formula of the regression
      • toLaTeX

        String toLaTeX​(int precision)
        Returns the formula of the regression, using the requested precision.
        Parameters:
        precision - precision to apply to the numbers of the formula
        Returns:
        the formula of the regression