set.seed(123)
n <-100
x <-rnorm(n)
y <-2 + 3*x + rnorm(n)
fit <- lm(y ~ x)
fit
## 
## Call:
## lm(formula = y ~ x)
## 
## Coefficients:
## (Intercept)            x  
##       1.897        2.948
summary(fit)
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9073 -0.6835 -0.0875  0.5806  3.2904 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.89720    0.09755   19.45   <2e-16 ***
## x            2.94753    0.10688   27.58   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9707 on 98 degrees of freedom
## Multiple R-squared:  0.8859, Adjusted R-squared:  0.8847 
## F-statistic: 760.6 on 1 and 98 DF,  p-value: < 2.2e-16
plot(x,y)
abline(fit, col = "red")