Sunday, September 26, 2021

How to do linear regression quickly with R

Check https://pythonforscientist.blogspot.com/2021/ for reference


Data set in https://cutt.ly/BEQUlnA 

>>>lin_reg <- lm(file_car$dist~file_car$speed)

#code above creates linear regression lm(y~x)





>>>lin_reg

>>> plot(file_car$speed,file_car$dist)





The plot code produces next graph that follows linear regression




To plot the line and see how it fits the values we wrote the code

>>>abline(lin_reg)




No comments:

Post a Comment