source("C:\\Users\\86167\\Desktop\\regression.R")

rate<-c(20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 
40, 42)
impurity <-c(8.4, 9.5, 11.8, 10.4, 13.3, 14.8, 
13.2, 14.7, 16.4, 16.5, 18.9, 18.5)
plot(impurity~rate)
reg<-lm(impurity~rate)
abline(reg,col="red")

summary(reg)
## 
## Call:
## lm(formula = impurity ~ rate)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.1834 -0.5432 -0.3233  0.8333  1.3900 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.28928    1.22079  -0.237    0.817    
## rate         0.45664    0.03844  11.880 3.21e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9193 on 10 degrees of freedom
## Multiple R-squared:  0.9338, Adjusted R-squared:  0.9272 
## F-statistic: 141.1 on 1 and 10 DF,  p-value: 3.211e-07