x <- c(2,3,2,5,4,6,7,1)
y <- c(2,1,3,4,5,3,2,1)
data <- data.frame(x,y)
mean(x)
## [1] 3.75
mean(y)
## [1] 2.625
var(x)
## [1] 4.5
var(y)
## [1] 1.982143
##standart sampalar
sd(x)
## [1] 2.12132
sd(y)
## [1] 1.407886
##covarsayon
cov(x,y)
## [1] 1.035714
##corelasyon
cor(x,y)
## [1] 0.3467897
##Regrasyon model
model <-lm(y~x)
summary(model)
##
## Call:
## lm(formula = y ~ x)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.4524 -1.0873 -0.1825 0.8552 2.3175
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.7619 1.0782 1.634 0.153
## x 0.2302 0.2541 0.906 0.400
##
## Residual standard error: 1.426 on 6 degrees of freedom
## Multiple R-squared: 0.1203, Adjusted R-squared: -0.02636
## F-statistic: 0.8202 on 1 and 6 DF, p-value: 0.4
##Grafik
plot(x,y)