#correlation
x<-c(2,3,4,5,8,9,12);x
## [1] 2 3 4 5 8 9 12
y<-c(10,20,40,50,80,90,120);y
## [1] 10 20 40 50 80 90 120
cor(x,y)
## [1] 0.9960101
z=lm(y~x);z
##
## Call:
## lm(formula = y ~ x)
##
## Coefficients:
## (Intercept) x
## -8.533 10.924
summary(z)
##
## Call:
## lm(formula = y ~ x)
##
## Residuals:
## 1 2 3 4 5 6 7
## -3.3152 -4.2391 4.8370 3.9130 1.1413 0.2174 -2.5543
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8.5326 3.0640 -2.785 0.0387 *
## x 10.9239 0.4377 24.957 1.93e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.887 on 5 degrees of freedom
## Multiple R-squared: 0.992, Adjusted R-squared: 0.9904
## F-statistic: 622.8 on 1 and 5 DF, p-value: 1.927e-06