R-squared is a statistical measure of how close the data are to the fitted regression line.

This statistic indicates the percentage of the variance in the dependent variable that the independent variables explain collectively.

**Formula to calculate r-squared.**

RSS is the sum of squares due to regression.

TSS is the total sum of squares.

**Example:**

Suppose your RSS is 2 and your TSS is 3, calculate your r squared.

Therefore, your r-squared is 0.67.