YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Correlation - Data Analysis with R

Get Embed Code
5 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. To look at the documentation, you'll simply type in
  2. ?cor.test. That will bring up this page. It looks
  3. like cor.test takes two vectors x and y. And
  4. then it will compute the correlation coefficient. It looks like
  5. we have a couple methods for determining that coefficient
  6. and we could either use pearson, kendall or spearman. For
  7. our purposes, we'll be using the pearson method. So
  8. your code might have looked like this. Writing this code,
  9. we get a correlation coefficient of 0.0274. This
  10. indicates that there's no meaningful relationship between the
  11. two variables. A good rule of thumb is
  12. that a correlation greater than 0.3 or less
  13. than minus 0.3, is meaningful, but small. Around
  14. 0.5 is moderate and 0.7 or greater is
  15. pretty large. Another way to compute the same
  16. coefficient is to use this code. Here, I'm using
  17. the width function for around the data frame. The width function let's us
  18. evaluate an R expression in an environment
  19. constructed from the data. Now, I know
  20. I haven't shown you this function yet but I wanted to introduce it to
  21. you. Running this bit of code we see that we get the same result.