Correlation and linear regression functions

SQL Anywhere supports a variety of statistical functions, the results of which can be used to assist in analyzing the quality of a linear regression.

For more information about the mathematical formulas represented by these functions see Mathematical formulas for the aggregate functions.

The first argument of each function is the dependent expression (designated by Y), and the second argument is the independent expression (designated by X).

  • COVAR_SAMP function   The COVAR_SAMP function returns the sample covariance of a set of (Y, X) pairs.

    For more information about the syntax for this function, see COVAR_SAMP function [Aggregate].

  • COVAR_POP function   The COVAR_POP function returns the population covariance of a set of (Y, X) pairs.

    For more information about the syntax for this function, see COVAR_POP function [Aggregate].

  • CORR function   The CORR function returns the correlation coefficient of a set of (Y, X) pairs.

    For more information about the syntax for this function, see CORR function [Aggregate].

  • REGR_AVGX function   The REGR_AVGX function returns the mean of the x-values from all the non-NULL pairs of (Y, X) values.

    For more information about the syntax for this function, see REGR_AVGX function [Aggregate].

  • REGR_AVGY function   The REGR_AVGY function returns the mean of the y-values from all the non-NULL pairs of (Y, X) values.

    For more information about the syntax for this function, see REGR_AVGY function [Aggregate].

  • REGR_SLOPE function   The REGR_SLOPE function computes the slope of the linear regression line fitted to non-NULL pairs.

    For more information about the syntax for this function, see REGR_SLOPE function [Aggregate].

  • REGR_INTERCEPT function   The REGR_INTERCEPT function computes the y-intercept of the linear regression line that best fits the dependent and independent variables.

    For more information about the syntax for this function, see REGR_INTERCEPT function [Aggregate].

  • REGR_R2 function   The REGR_R2 function computes the coefficient of determination (also referred to as R-squared or the goodness of fit statistic) for the regression line.

    For more information about the syntax for this function, see REGR_R2 function [Aggregate].

  • REGR_COUNT function   The REGR_COUNT function returns the number of non-NULL pairs of (Y, X) values in the input. Only if both X and Y in a given pair are non-NULL is that observation be used in any linear regression computation.

    For more information about the syntax for this function, see REGR_COUNT function [Aggregate].

  • REGR_SXX function   The function returns the sum of squares of x-values of the (Y, X) pairs.

    The equation for this function is equivalent to the numerator of the sample or population variance formulae. Note, as with the other linear regression functions, that REGR_SXX ignores any pair of (Y, X) values in the input where either X or Y is NULL.

    For more information about the syntax for this function, see REGR_SXX function [Aggregate].

  • REGR_SYY function   The function returns the sum of squares of y-values of the (Y, X) pairs.

    For more information about the syntax for this function, see REGR_SYY function [Aggregate].

  • REGR_SXY function   The function returns the difference of two sum of products over the set of (Y, X) pairs.

    For more information about the syntax for this function, see REGR_SXY function [Aggregate].