Correlation Coefficient
Sample Java Applets from Seeing Statistics
by Gary McClelland

The correlation coefficient measures how much two variables are "co-related." If there is no co-relationship, then the correlation coefficient equals 0. If the two variables are perfectly co-related, then the coefficient equals 1. If one variable is perfectly related to the reverse of the other, then the coefficient equals -1.

Use your mouse to drag the slider (or click on the bar or its end points) to change the relationship between the two variables. Notice how the correlation coefficient r changes.

Browser Notes:

  • IE4 on Windows95: display doesn't update while slider is being moved. It is best to click on the slider bar or at its end to move it in jumps. Or use Netscape 4.05 instead.
  • Netscape 4.x on Solaris/Unix: The slider bars are a mess. Somewhat better in Netscape 3.x.
  • Everything works fine on Windows95 using Netscape 4.x and on Macs using either Netscape 4.x or IE4.

Correlation and Regression

This graph also shows the best-fitting regression line. When the correlation is zero, the slope of the best-fitting line is 0. As the correlation increases, the slope of the line becomes steeper. Again, move the slider to explore these relationships.

Votes for Slopes

Each point "votes" for the best slope. Those votes are determined by the slope of the line from the point to the center point defined by the mean of X and the mean of Y. The slope of the best-fitting line is the weighted average of all the individual slopes. The votes for those observations whose X values are further away from the center count more. This graph shows the individual slopes in red and the center point in green. Note as you move the slider how the votes for the slopes increasingly agree as the correlaton coefficient increases.

Return to Menu Page

Note: The correlation applet on this page is part of the electronic textbook Seeing Statistics. This applet may not be copied, retransmitted, or used except on this page without the express written permission of the author.
© 1998, Gary H. McClelland.