• Managing your videos in Amara teams just got easier! Read about it in our latest blog post. Hide

← Correlation - Data Analysis with R

• 3 Followers
• 21 Lines

Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=iu6CxSkq-wg" data-team="udacity"></div> ``` 5 Languages

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

1. To look at the documentation, you'll simply type in
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.