WebCab Probability and Statistics Web Services for .NET v3.6

Correlation.CoefficientOfDetermination Method 

Calculates the coefficient of determination (denoted R-squared or R2) for the set of pairs of points: (xValues[0], yValues[0]), (xValues[1], yValues[1]),..., (xValues[n], yValues[n]).

public double CoefficientOfDetermination(
   double[] xValues,
   double[] yValues
);

Parameters

xValues
An array where the k-th element corresponds to the value in the 1st coordinate of the k-th data point (i.e. xValues[k] above).
yValues
An array where the k-th element corresponds to the value in the 2nd coordinate of the k-th data point (i.e. yValues[k] above).

Return Value

the coefficient of determination of the set of pairs.

Remarks

This statistics will always take a value within the interval [0,1], and is used to evaluated to what degree the given data can be fit to a linear regression line. That is, this statistic is a goodness of fit measure for the regression line which can be evaluated using LeastSquaresRegressionLineY.

Explanation of the Coefficient of Determination

The coefficient of determination is purely the following ratio:

R2 = SSR/SST,

where,

  1. SSR = sum of squares due to regression (i.e. the sum of the squares in the 2nd coordinates of the difference between the data points and the corresponding point of the regression line.
  2. SST = total sum of squares (i.e. the sum of the squares in the 2nd coordinate of the difference between the mean of the data points and each of the points on the regression line correspond to each of the data points.

Intuitively the coefficient of determination is the amount of variation in the second variable (i.e. Y) which is explained by the regression line of the second variable Y on the first variable X, divided by the total amount of variation of the second variable (i.e. Y).

See Also

Correlation Class | Correlation Namespace