Simple task - Linear regression

Morning...

I am a new R user, and need to use linear regression using an excel file that has two columns

x y
5,2 13
5,1 15
4,9 18
4,6 20
4,7 19
4,8 17
4,6 21
4,9 16

Have to find B0 B1,...

Looks like a textbook example:

set.seed(1)

x <- sample(1:10)
y <- sample(31:40)

m <- lm(y ~ x, data= tibble::tibble(x, y) )
m$coefficients
#> (Intercept)           x 
#> 35.13333333  0.06666667

Created on 2019-09-10 by the reprex package (v0.3.0)

2 Likes