Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Usage » Query and modify data » OLAP support » Window functions

 

Correlation and linear regression functions

A variety of statistical functions is supported, the results of which can be used to assist in analyzing the quality of a linear regression.

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.

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

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

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

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

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

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

  • 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.

  • 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.

  • 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 formulas. 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.

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

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

 See also