How to make a scatterplot in R (with regression line)

116,324
0
Published 2017-06-23
This tutorial shows how to make a scatterplot in R. We also add a regression line to the graph. We also make a scatterplot with a third variable to add extra insight into our graph.

Thank you for watching this video. Make sure to like the video if you found it helpful and subscribe if you want to see more videos like this one!

All Comments (21)
  • @sonam502
    thank you! very simple, straight to the point and very organized
  • Dude thankyou so much been stuck on this all day!! You’ve helped massively!!
  • @lilia.2869
    Thanks for the help! Very easy to follow
  • @remonhany
    That was really helpful, THANK YOU!
  • @emilygalen3371
    Is your third variable on your 'Enhanced Scatter Plot' a control or an instrument? Thanks for the video!
  • @SerafinKeilin
    You explained that easy and short and I understood it and it really helped right away, thanks alot!
  • Hey! Thank you very much for your useful video. I was just wonderin though: somehow I have made it such that my plots appear in a new window (i.e not in the console). Every plot I do, it makes a new window that minimises when I change my code. How do I change it bac so that my plots appear only in the plot section of the console?
  • @21Arrozito
    is it necessary to specify the data source in the abline function? I tried with specifying it and without it and the same regression line still plots the same either way.
  • Great video, but I am trying to do just this, had the same code you used. R didnt return any errors, but my regression line does not show up on my scatterplot. Any help on why that is would be appreciated.
  • Please I am working with several subsets of data, can I get an explanation on what to do. The question goes like this, for birth weights and pregnancy, I should assign women who smoke to 1, those who don't to 2, and those who never tried to 3. Them I should later plot a graph of the birth weight in addition to the pregnancy of those who didn't, thus 2.
  • Hi. Thank you for this video. I have one question: How can I get the R -squared value or other information about regression, for each regression line recognized trough a third variable with "car-scatterplot"? If I use summary(lm(y~x,data=mydata)) I have information about the whole selected dataset and not about each subgroup recognized trough "car-scatterplot" and a third variable. I hope the question is clear. Sorry, but I'm newbie of R.
  • @Benjamin-el9sp
    thank you so much sir but can you show us how to calculate the p-value to see if this reverse correlation is significant enough?