R Squared Formula
R Squared formula, also known as the coefficient of determination, is generally represented by R2 or r2, giving the number indicating the variance in the dependent variable that is to be predicted from the independent variable. It is a statistical model that is used for future predictions and outcomes. R squared formula is also regarded as testing of the hypothesis. It helps in the determination of the linear relation between the dependent and independent variables. Let us understand the r squared formula in detail in the following section.
What is R Squared Formula?
The r squared formula calculates the value R^{2}, which is used to analyze how differences in one variable can be explained by a difference in a second variable. To find the r squared value, we calculate the square of coefficient of correlation, R. The r squared formula is given as,
\(\large R^{2}=\left[\frac{N\sum xy\sum x \sum y}{\sqrt{\left[N\sum x^{2}\left(\sum x\right)^{2}\right]\left[N\sum y^{2}\left(\sum y\right)^{2}\right]}}\right]^2\)
where,
 R = Coefficient of correlation
 N = No of scores given
 ∑ XY = Sum of paired product
 ∑ X = X score sum
 ∑ Y = Y score sum
 ∑ X^{2} = square of X score sum
 ∑ Y^{2} = square of Y score sum
Let us now look at a few solved examples on r squared formula to understand the concept better.
Solved Examples Using R Squared Formula

Example 1: Find R^{2} using r squared formula for the following set of data:
X Y 1 2 3 5 4 6 7 7 Solution:
Given data is:
X Y 1 2 3 5 4 6 7 7 Creating table out of given scores, we get,
X Y XY X^{2} Y^{2} 1 2 2 1 4 3 5 15 9 25 4 6 24 16 36 7 7 49 49 49 ∑X=15 ∑Y=20 ∑XY=90 ∑X^{2}=75 ∑Y^{2}=114 Here, N = 4
The coefficient of correlation is given by
\(\large R=\frac{N\sum xy\sum x \sum y}{\sqrt{\left[N\sum x^{2}\left(\sum x\right)^{2}\right]\left[N\sum y^{2}\left(\sum y\right)^{2}\right]}}\)
\(=\frac{4(90)(15)(20)}{\sqrt{4(75)15^{2}}\sqrt{4(114)20^{^{2}}}}\\ = \frac{360300}{\sqrt{75}\sqrt{56}}\\ = 0.926\)Using r squared formula, R^{2} = 0.857
Answer: R^{2} for given data = 0.857.

Example 2: Calculate R^{2} using the r squared formula for given data:
X = 4, 8 ,12, 16 and
Y = 7, 14, 21, 28
Solution:
We will first construct a table to get the required values for the r^{2} formula:
X Y X^{2} Y^{2} XY 4 7 16 49 28 8 14 64 196 112 12 21 144 441 252 16 28 256 784 448 ∑X=40 ∑Y=70 ∑X^{2}=480 ∑Y^{2}=1,470 ∑XY=840 The coefficient of correlation is given by,
\(\large R=\frac{N\sum xy\sum x \sum y}{\sqrt{\left[N\sum x^{2}\left(\sum x\right)^{2}\right]\left[N\sum y^{2}\left(\sum y\right)^{2}\right]}}\)
\( \begin{align*} r &= \frac{ 4\times 840  (40)(70) }{\sqrt{[4 \times 480  (40)^2][4 \times 1,470  (70)^2]}} \\ &= \frac{3,360  2,800}{ \sqrt{[1,920  1,600][5,880  4,900]}} \\ &= \frac{560}{560} \\ &= 1 \end{align*}\)
Using r squared formula, R^{2} = 1
Answer: R^{2} for the given data = 1.