We also know R-squared as the coefficient of determination. It is the statistical measurement of the correlation between an investment’s performance and a specific benchmark index. So, in another way, it shows what degree a stock or portfolio’s performance can be attributed to a benchmark index. In this topic, we will discuss the R Squared formula with examples. Let us learn it!

**R Squared Formula**

**What Is R-Squared?**

R-squared \((R^2)\) is popular as a statistical measure that represents the proportion of the variance for a dependent variable. It explained an independent variable or variables in a regression model. Whereas correlation explains the strength of the relationship between two variables independent and dependent variables. R-squared explains to what extent the variance of one variable explains the variance of the second one. So, if the \(R^2\) value of a model is 0.50, then approximately half of the observed variation will be explained by its inputs.

In investing, R-squared is generally interpreted as the percentage of some fund or security movements which can be explained by movements in the benchmark index. For example, an R-squared for fixed-income security versus some specific bond index will identify the security’s proportion of price movement since it is predictable as per the price movement of the index. The same can be applied to the stock versus the S & P 500 index, or any other related relevant index.

**The Formula for R-Squared :**

R Squared is also known as the coefficient of determination and represented by R² or r² and pronounced as R Squared- is the number indicating the variance in the dependent variable that is predicted from the independent variable. It is a statistical model used for future prediction and outcomes, and it is regarded as testing of hypothesis. The linear relation between the dependent and independent variables is referred through some formula.

Here we can see how to calculate and interpret such coefficients for ordinal and interval level scales. Methods of computation will summarize the relationship between two variables in a single number which is known as the R-squared coefficient. The coefficient is usually shown by the symbol R^2 and it ranges from -1 to +1.

**Following is the Formula for R Squared:**

\(\large R^{2}=\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]}}\)

- N = No of scores given
- \(\Sigma XY\) = Sum of paired product
- \(\Sigma X\) = X score sum
- \(\Sigma Y\) = Y score sum
- \(\Sigma X^2\) = square of X score sum
- \(\Sigma Y^2\) = square of Y score sum

**Solved Examples for R Squared Formula**

Q.1: Calculate the correlation coefficient for the following data.

X = 4, 8 ,12, 16 and

Y = 5, 10, 15, 20.

Solution:

Given variables are,

X = 4, 8 ,12, 16 and

Y = 5, 10, 15, 20

To find the linear coefficient of given data, let us construct a table to get the required values of the formula.

X | Y | \(X^2\) | \(Y^2\) | XY |

4 | 5 | 16 | 25 | 20 |

8 | 10 | 64 | 100 | 80 |

12 | 15 | 144 | 225 | 180 |

16 | 20 | 256 | 400 | 320 |

\(\sum X = 40\) | \(\sum Y =50\) | \(\sum X^2= 480\) | \(\sum Y^2 = 750\) | \(\sum XY= 600\) |

Now,

\(R^2 = \frac{N\times \sum{XY}-(\sum{X}\sum{Y})}{\sqrt{ [N\sum{x^2}-(\sum{x})^2 ][N \sum{y^2}-(\sum{y})^2 }]}\)

Putting all the values,

\(R^2 = \frac{4\times 600-(40\times 50)}{\sqrt{ [4\times 480-(40)^2 ][4\times 750-(50)^2 }]}\)

Solving we get

\(R^2 = \frac{400}{17.89\times22.36}\)

\(= \frac{400}{400}\)

= 1

Therefore correlation coefficient is 1.

I get a different answer for first example.

I got Q1 as 20.5

median 23 and

Q3 26