Math 2.0

Statistics Definition

Coefficient of determination

Builds on Ordinary least squaresSample mean

Definition

Let y1,…,yny_1, \dots, y_n be observed values of a response, not all equal, and let y^1,…,y^n\hat y_1, \dots, \hat y_n be the fitted values of a regression model. Let yˉ=1n∑i=1nyi\bar y = \frac{1}{n} \sum_{i=1}^n y_i be the sample mean. The total sum of squares is SStot=∑i=1n(yi−yˉ)2SS_{\mathrm{tot}} = \sum_{i=1}^n (y_i - \bar y)^2. The residual sum of squares is SSres=∑i=1n(yi−y^i)2SS_{\mathrm{res}} = \sum_{i=1}^n (y_i - \hat y_i)^2. The coefficient of determination is R2=1−SSresSStot.R^2 = 1 - \frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}.

Remarks

Example: take the points (xi,yi)=(0,0),(1,1),(2,3)(x_i, y_i) = (0,0), (1,1), (2,3) and fit y=a+bxy = a + bx by ordinary least squares. The fit is b=3/2b = 3/2, a=−1/6a = -1/6, with fitted values −1/6-1/6, 4/34/3, 17/617/6. Then SSres=1/36+4/36+1/36=1/6SS_{\mathrm{res}} = 1/36 + 4/36 + 1/36 = 1/6 and SStot=16/9+1/9+25/9=14/3SS_{\mathrm{tot}} = 16/9 + 1/9 + 25/9 = 14/3, so R2=1−1/28=27/28R^2 = 1 - 1/28 = 27/28.

When the fit is by ordinary least squares with an intercept, SStot=SSreg+SSresSS_{\mathrm{tot}} = SS_{\mathrm{reg}} + SS_{\mathrm{res}} with SSreg=∑i(y^i−yˉ)2SS_{\mathrm{reg}} = \sum_i (\hat y_i - \bar y)^2. So R2=SSreg/SStotR^2 = SS_{\mathrm{reg}} / SS_{\mathrm{tot}} lies in [0,1][0, 1]. In that case R2R^2 is the square of the sample correlation between yy and y^\hat y. For a straight line fit it is the square of the sample correlation between xx and yy.

Non-example: if the fitted values do not come from least squares with an intercept, the formula can give a negative number. With the same data and the constant prediction y^i=3\hat y_i = 3, one gets SSres=13>SStotSS_{\mathrm{res}} = 13 > SS_{\mathrm{tot}}, so R2<0R^2 < 0.

The adjusted R2R^2 for a model with pp coefficients, including the intercept, is 1−(1−R2)(n−1)/(n−p)1 - (1 - R^2)(n - 1)/(n - p). It penalises extra regressors.

Reading path

To understand this page from the ground up, read these 3 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Ordinary least squares concept
  2. Sample mean concept
  3. Coefficient of determination definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Coefficient_of_determination
About this page
TagXKGEV5RP3T
URIm2://XKGEV5RP3T
Kinddefinition
WritingW0 stub
MSC62J05
DefinesCoefficient of determination
UsesOrdinary least squares, Sample mean

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.