When a wicked mirror shard turns Kay’s heart cold, his best friend Gerda refuses to give up on him. This magical fairy tale follows her brave journey through forests, palaces and icy kingdoms to melt the spell with the warmth of her love.
X <- c(2, 1, 1, 0, 5, 0)
Y <- c(4, 9, 6, -2, 9, 7)
n <- length(X)
n
## [1] 6
toplamx <- sum(X)
toplamx
## [1] 9
ortalama_x <- toplamx/n
ortalama_x
## [1] 1.5
ortalama_xx <- mean(X)
ortalama_xx
## [1] 1.5
ortalama_y <- mean(Y)
ortalama_y
## [1] 5.5
\[ \sigma^2 = \frac{ \sum_{i =1}^n (x_i - \bar x)^2}{n} \]
df <- data.frame(cbind(X,Y))
model <- lm(Y ~ X, data = df)
model
##
## Call:
## lm(formula = Y ~ X, data = df)
##
## Coefficients:
## (Intercept) X
## 3.914 1.057
cov(X,Y)/var(X)
## [1] 1.057143