##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## [1] FALSE
Veri setinde eksik veri yok.
library(dplyr)
library(knitr)
gender_table <- table(veri$Cinsiyet) # Cinsiyetin frekansı
ses_table <- table(veri$SES) # SES'in frekansı
kable(gender_table, caption = "Cinsiyet Dağılımı", format = "markdown")
Var1 | Freq |
---|---|
1 | 257 |
2 | 74 |
Var1 | Freq |
---|---|
1 | 18 |
2 | 262 |
3 | 51 |
library(ggplot2)
# Cinsiyet Dağılımı Grafiği
ggplot(veri, aes(x = Cinsiyet, fill = Cinsiyet)) +
geom_bar() +
labs(title = "Cinsiyet Dağılımı", x = "Cinsiyet", y = "Frekans") +
theme_minimal()
## Warning: The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?
# SES Dağılımı Grafiği
ggplot(veri, aes(x = SES, fill = SES)) +
geom_bar() +
labs(title = "SES Dağılımı", x = "SES", y = "Frekans") +
theme_minimal()
## Warning: The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?
boyut1_sorular <- c("WV1", "WV2", "WV3","WV4","WV5","WV6","WV7","WV8","WV9") # Boyut1'in soruları
boyut2_sorular <- c("WV10", "WV11", "WV12","WV13","WV14","WV15","WV16") # Boyut2'nin soruları
# Boyut1 ve Boyut2'nin toplam puanlarını hesaplama
veri$boyut1_toplam <- rowSums(veri[boyut1_sorular], na.rm = TRUE)
veri$boyut2_toplam <- rowSums(veri[boyut2_sorular], na.rm = TRUE)
# Hesaplanan toplamları kontrol et
head(veri)
## # A tibble: 6 × 20
## Cinsiyet SES WV1 WV2 WV3 WV4 WV5 WV6 WV7 WV8 WV9 WV10
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2 2 5 6 5 7 7 6 5 7 7 4
## 2 2 3 2 6 5 6 6 7 7 7 7 7
## 3 2 2 7 7 7 7 7 7 7 7 7 2
## 4 2 2 2 4 4 6 4 2 5 2 4 5
## 5 2 2 7 6 7 7 5 6 5 7 7 4
## 6 2 3 2 2 3 2 3 2 3 2 3 5
## # ℹ 8 more variables: WV11 <dbl>, WV12 <dbl>, WV13 <dbl>, WV14 <dbl>,
## # WV15 <dbl>, WV16 <dbl>, boyut1_toplam <dbl>, boyut2_toplam <dbl>
# Boyut1 için histogram
ggplot(veri, aes(x = boyut1_toplam)) +
geom_histogram(bins = 15, fill = "#0c4c8a", color = "black", alpha = 0.7) +
labs(title = "Boyut1 Alt Boyutunun Toplam Puan Dağılımı", x = "Boyut1 Toplam Puan", y = "Frekans") +
theme_minimal()
# Boyut2 için histogram
ggplot(veri, aes(x = boyut2_toplam)) +
geom_histogram(bins = 15, fill = "#ff7f0e", color = "black", alpha = 0.7) +
labs(title = "Boyut2 Alt Boyutunun Toplam Puan Dağılımı", x = "Boyut2 Toplam Puan", y = "Frekans") +
theme_minimal()
## Zorunlu paket yükleniyor: ggpp
## Registered S3 methods overwritten by 'ggpp':
## method from
## heightDetails.titleGrob ggplot2
## widthDetails.titleGrob ggplot2
##
## Attaching package: 'ggpp'
## The following object is masked from 'package:ggplot2':
##
## annotate
mean_boyut2 <- mean(veri$boyut2_toplam, na.rm = TRUE)
sd_boyut2 <- sd(veri$boyut2_toplam, na.rm = TRUE)
library(ggplot2)
# Boyut2'nin toplam puan dağılımını gösteren tek bir grafik
ggplot(veri, aes(x = boyut2_toplam)) +
geom_histogram(bins = 30, fill = "#0c4c8a", color = "black", alpha = 0.7) +
geom_vline(xintercept = 33.027, color = "red", linetype = "dashed") +
annotate("text", label = "Ort = 33.027", x = 30, y = 100, color = "black") +
geom_vline(xintercept = 42.858, color = "blue", linetype = "dashed") +
annotate("text", label = "Ort = 42.858", x = 40, y = 100, color = "black") +
geom_vline(xintercept = 23.196, color = "blue", linetype = "dashed") +
annotate("text", label = "Ort = 26.196", x = 20, y = 100, color = "black")
ggplot(veri, aes(x = boyut1_toplam)) +
geom_histogram(bins = 15, fill = "#ff7f0e", color = "black", alpha = 0.7) +
labs(title = "Boyut1 Alt Boyutunun Toplam Puan Dağılımı", x = "Boyut1 Toplam Puan", y = "Frekans") +
theme_minimal()
ggplot(veri, aes(x = boyut2_toplam)) +
geom_histogram(bins = 15, fill = "#ff7f0e", color = "black", alpha = 0.7) +
labs(title = "Boyut2 Alt Boyutunun Toplam Puan Dağılımı", x = "Boyut2 Toplam Puan", y = "Frekans") +
theme_minimal()
Boyut 1 toplam puanlarında uç 10 civarındaki değerler uç değer gibi görünüyor.
Tahmin ettiğim gibi kutu grafiğinde Boyut1 toplam puanları için uç
değerler mevcut.
## [1] 19 19 19 19 18 16 9 18 18
out_ind <- which(veri$boyut1_toplam %in% c(out)) # Bu uç değerlerin age değişkeninde hangi gö
out_ind
## [1] 21 22 36 37 64 73 273 315 330
yukarıdaki satırlarda boyut toplam puanı değişkenine ait uç değerler mevcut.
## numeric(0)
Boyut 2 için uç değer mevcut değil
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
## [1] 6.328962 11.681320 16.284104 21.273589 8.728027 18.160828 18.595229
## [8] 19.002760 5.906684 9.193047 8.379454 13.021651 6.278271 19.682734
## [15] 35.822392 12.826709 21.837407 41.066276 12.295411 6.322811
## [1] 39.25235
## # A tibble: 12 × 16
## WV1 WV2 WV3 WV4 WV5 WV6 WV7 WV8 WV9 WV10 WV11 WV12 WV13
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 7 5 7 2 2 1 1 4 1 3 5 5 7
## 2 7 5 7 7 7 3 7 1 7 5 1 4 4
## 3 1 1 6 5 2 6 7 4 2 3 7 7 5
## 4 3 7 3 1 1 1 1 2 7 7 7 7 7
## 5 7 5 4 5 2 1 3 7 7 7 1 7 5
## 6 2 3 5 3 7 4 1 3 2 3 1 4 3
## 7 6 2 7 5 6 6 2 4 7 5 7 3 4
## 8 3 7 7 3 1 1 3 7 2 5 7 1 5
## 9 7 2 7 3 1 1 1 6 7 5 7 1 1
## 10 5 7 6 1 6 1 1 2 4 6 7 1 6
## 11 7 7 7 7 7 7 7 7 7 1 1 1 7
## 12 6 2 1 7 5 1 5 7 7 6 3 7 7
## # ℹ 3 more variables: WV14 <dbl>, WV15 <dbl>, WV16 <dbl>
Yukarıda elde edilen çok değişkenli uç değerlerde veri setinden silinmelidir.
son durumda 310 gözlem ile analizlere devam edilebilir.
** Ödevi tamamlamam yaklaşık 1.5 saat sürdü