 Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - SQL Usage » Querying and Modifying Data » OLAP support » Window functions in SQL Anywhere

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

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