DISCOVER

# How to Calculate R2 Value

Updated April 17, 2017

R2, also known as R-squared or line regression, is how well two points of data on a graph correlate. In other words, calculating R2 is using mathematics to find one straight line that can represent all the points, high and low, on a graph. This is virtually impossible to do because there are so many non-corresponding points on most graphs, but by calculating R2 you can come to a reasonable approximation.

Add up the sum of all points along the X axis to find the variable Xsum.

Add up the sum of all the points along the Y axis to find the variable Ysum.

Establish N as the variable for the total number of trials/points in your experiment. List the N values of X and Y in two horizontal rows, with X over Y. Multiply Xn and Yn as they vertically correspond, then add the products together to find the variable XYsum. For example, if the X column is 1, 2, 3 and 4, and the Y column is 8, 7, 6 and 5, the formula to find XYsum is: (1 x 8) + (2 x 7) + (3 x 6) + (4 x 5).

Square each value in the X column and then add them together to find the variable X^2 sum.

Square each value in the Y column and then add them together to find the variable Y^2 sum.

Perform the following formula to find R-squared: R^2 = (N_XYsum - Xsum_Ysum)^2 รท (N_X^2 sum - Xsum_Xsum) (N_Y^2 sum - Ysum_Ysum).