...

/

R-square and Goodness of the Fit

R-square and Goodness of the Fit

Let’s understand R-squared and the goodness of the fit.

Let’s understand the r-square and the goodness of fit.

R-squared

The coefficient of determination, R2R^2 or r2r^2 (“R-squared”), is the proportion of the variance in the dependent variable that is predictable from the independent variable(s). It measures how well-observed outcomes are replicated by the model based on the proportion of total variation of outcomes explained by the model.

The better the linear regression (on the right) fits the data in comparison to the simple average (on the left graph), the closer the value of R2R^2 is to 1. The areas of the blue squares represent the squared residuals concerning the linear regression. The areas of the red squares represent the squared residuals concerning the average value.

Key limitations of R-squared:

  • Can’t determine whether the coefficient estimates and predictions are biased, so we must assess (evaluate) the residual plots.

  • Does not indicate whether a regression model is adequate. We can have a low R-squared value for a good model or a high R-squared value for a model that does not fit the data.

  • It’s possible to get a negative value of R-squared. If the fit is worse than a horizontal line, the R-squared is negative. In this case, the R-squared can’t be interpreted as the square of a correlation. Such situations indicate that a constant term should be added to the model.

Now, let’s get into more detail about R-squared vs. adjusted R-squared.

R-squared vs. adjusted R-squared

Typically, the accuracy score R2R^2,

R2=1Explained varianceTotal variance=1fraction of unexplained variance=1i=1n(yiy^i)2i=1n(yiyˉ)2\small \begin{align*} R^2 &= 1- \frac{\text{Explained variance}}{\text{Total variance}}\\ &= 1 - {\text{fraction of unexplained variance}}\\ &= 1 - \frac{\sum_{i=1}^n(y_i - \hat{y}_i)^2}{\sum_{i=1}^n(y_i - \bar{y})^2} \end{align*} ...

Access this course and 1200+ top-rated courses and projects.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy