table(Boston_tr$nehir_kenari)
##
## 0 1
## 471 35
prop.table(table(Boston_tr$nehir_kenari))*100
##
## 0 1
## 93.083004 6.916996
Boston_tr <- Boston_tr|> select(oda_sayisi, konut_degeri) |> na.omit()
ggplot(Boston_tr, aes(x= oda_sayisi, y= konut_degeri)) + geom_point() + labs(x = "Oda Sayisi (adet)", y = "Konut Degeri", title = "Oda Sayisi İLE Konut Degeri Arasındaki İliskisi")
Boston_mod <- lm (oda_sayisi ~ konut_degeri , data = Boston_tr)
summary(Boston_mod)
##
## Call:
## lm(formula = oda_sayisi ~ konut_degeri, data = Boston_tr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.98750 -0.24448 0.01893 0.27379 2.52898
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.087639 0.059510 85.49 <2e-16 ***
## konut_degeri 0.053122 0.002446 21.72 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5054 on 504 degrees of freedom
## Multiple R-squared: 0.4835, Adjusted R-squared: 0.4825
## F-statistic: 471.8 on 1 and 504 DF, p-value: < 2.2e-16
coef(Boston_mod)
## (Intercept) konut_degeri
## 5.08763867 0.05312235
ggplot (Boston_tr, aes(x= oda_sayisi, y= konut_degeri)) + geom_point() + geom_smooth(method = "lm", se = FALSE, color= "red") + labs( x= "Oda Sayisi (adet)" , y = "Konut Degeri", title = "Oda Sayisi ile Konut Değeri Arasındaki İliskisi")
## `geom_smooth()` using formula = 'y ~ x'
#Grafige göre oda sayisi arttikca konut degeride artmakta olduğu görülmektedir. Oda sayisi ile Konut degeri arasındaki iliski pozitif yöndedir.
glimpse(Boston_tr)
## Rows: 506
## Columns: 2
## $ oda_sayisi <dbl> 6.575, 6.421, 7.185, 6.998, 7.147, 6.430, 6.012, 6.172, 5…
## $ konut_degeri <dbl> 24.0, 21.6, 34.7, 33.4, 36.2, 28.7, 22.9, 27.1, 16.5, 18.…
coef(Boston_mod)
## (Intercept) konut_degeri
## 5.08763867 0.05312235
#Bu kod b0 (kesisim), b1(egim) değerlerini vermektedir. Konut degerinin 0.05312235, oda sayisinin 5.08763867’dir.
#geom_jitter fonksiyonun kullanım amaci ust uste binen gözlemleri daha net gösterebilmek içindir. Veri yogunlugunu daha net gosterir. Ayni degere sahip gozlemler ayirt edilebilir.