df <- read_sav("C:/Users/Lenovo/Desktop/processed_data.sav")
# Madde kalite kontrolü
item_quality <- df %>%
filter(RESP == 1) %>%
mutate(score_bin = ifelse(SCORE == 2, 1, 0)) %>%
group_by(ITEM) %>%
summarise(
n_resp = n(),
p_correct = mean(score_bin, na.rm = TRUE),
sd_score = sd(score_bin, na.rm = TRUE)
) %>%
filter(
p_correct > 0.05,
p_correct < 0.95,
sd_score > 0.05
)
good_items <- item_quality$ITEM
df <- df %>% filter(ITEM %in% good_items)
# Madde yanıt matrisi
df_items <- df %>%
filter(RESP == 1) %>%
mutate(SCORE_bin = ifelse(SCORE == 2, 1, 0)) %>%
select(IDSTU, ITEM, SCORE_bin) %>%
pivot_wider(names_from = ITEM, values_from = SCORE_bin)
item_quality %>%
kable(caption = "Tablo 1: Madde Kalite Kontrolü",
col.names = c("Madde", "Yanıt Sayısı", "Doğru Yanıt Oranı", "Standart Sapma"),
align = "c") %>%
kable_styling()
Tablo 1: Madde Kalite Kontrolü
|
Madde
|
Yanıt Sayısı
|
Doğru Yanıt Oranı
|
Standart Sapma
|
|
1
|
3729
|
0.3515688
|
0.4775242
|
|
2
|
4068
|
0.4233038
|
0.4941434
|
|
3
|
4154
|
0.7867116
|
0.4096790
|
|
4
|
3640
|
0.6098901
|
0.4878417
|
|
5
|
4158
|
0.4920635
|
0.4999971
|
|
6
|
4012
|
0.4852941
|
0.4998460
|
|
7
|
3968
|
0.4138105
|
0.4925774
|
|
8
|
3814
|
0.4412690
|
0.4966038
|
|
9
|
3904
|
0.4228996
|
0.4940830
|
|
10
|
4154
|
0.3269138
|
0.4691419
|
|
11
|
3223
|
0.5513497
|
0.4974334
|
|
12
|
4049
|
0.2536429
|
0.4351493
|
|
13
|
3838
|
0.4301720
|
0.4951645
|
|
14
|
3311
|
0.6224706
|
0.4848422
|
|
15
|
3947
|
0.3569800
|
0.4791695
|
|
16
|
4009
|
0.3489648
|
0.4767023
|
|
17
|
3852
|
0.3886293
|
0.4875021
|
|
18
|
3713
|
0.3738217
|
0.4838823
|
|
19
|
4018
|
0.3008960
|
0.4587046
|
|
20
|
3759
|
0.3945198
|
0.4888123
|
|
21
|
3560
|
0.1946629
|
0.3959966
|
|
22
|
3714
|
0.3099085
|
0.4625179
|
|
23
|
3455
|
0.2998553
|
0.4582607
|
|
24
|
3768
|
0.3067941
|
0.4612244
|
|
25
|
3336
|
0.3462230
|
0.4758366
|
|
26
|
3599
|
0.2809114
|
0.4495067
|
library(mirt)
library(dplyr)
library(tibble)
library(DT)
# IRT modelini oluştur
irt_model <- mirt(
data = df_items %>% select(-IDSTU),
model = 1,
itemtype = "2PL",
technical = list(NCYCLES = 1000),
verbose = FALSE
)
# Parametreleri çıkar ve düzenle
irt_params <- coef(irt_model, simplify = TRUE)$items %>%
as.data.frame() %>%
rownames_to_column(var = "ITEM") %>%
rename(a = a1, b = d) %>%
mutate(
difficulty_group = cut(b,
breaks = c(-Inf, -0.5, 0.5, Inf),
labels = c("Düşük", "Orta", "Yüksek"))
)
# Şık bir interaktif tablo ile göster
datatable(
irt_params,
options = list(
pageLength = 10,
autoWidth = TRUE
),
rownames = FALSE,
class = "display nowrap compact",
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: left; font-weight: bold;',
'Tablo: ', htmltools::em("2PL Modeline Göre Madde Parametreleri")
)
)
library(ggplot2)
library(dplyr)
library(plotly)
# Öğrenci yetenek puanları
thetas <- fscores(irt_model, method = "EAP")[, 1]
theta_data <- fscores(irt_model, method = "EAP")[,1] %>%
as.data.frame() %>%
rownames_to_column(var = "IDSTU") %>%
rename(theta = 1)
# Madde zorlukları
item_data <- irt_params %>%
select(ITEM, b, difficulty_group)
# ggplot tabanlı Wright Map
p <- ggplot() +
geom_histogram(data = theta_data, aes(x = theta),
binwidth = 0.25, fill = "lightblue", color = "white") +
geom_vline(data = item_data, aes(xintercept = b, color = difficulty_group,
text = paste("Madde:", ITEM, "<br>Zorluk (b):", round(b, 2))),
linetype = "dashed", linewidth = 1) +
geom_text(data = item_data, aes(x = b, y = 2, label = ITEM),
angle = 90, vjust = -0.5, size = 3.5) +
scale_color_manual(values = c("Düşük" = "green", "Orta" = "orange", "Yüksek" = "red")) +
labs(
title = "Etkileşimli Wright Map",
x = "Yetenek / Zorluk (θ / b)",
y = "Öğrenci Sayısı",
color = "Zorluk Grubu"
) +
theme_minimal(base_size = 13)
#26 maddenin cronbach alpha değeri
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(dplyr)
library(magrittr)
##
## Attaching package: 'magrittr'
## The following object is masked from 'package:purrr':
##
## set_names
## The following object is masked from 'package:tidyr':
##
## extract
alpha_value <- alpha(df_items %>% select(-IDSTU))
cat("Cronbach's Alpha Değeri:", round(alpha_value$total$raw_alpha, 3), "\n")
## Cronbach's Alpha Değeri: 0.954
library(DT)
# Her iki veri setinde de ITEM sütununu karaktere çevir
df <- df %>% mutate(ITEM = as.character(ITEM))
irt_params <- irt_params %>% mutate(ITEM = as.character(ITEM))
# Sonra madde istatistiklerini hesapla ve birleştir
item_stats <- df %>%
filter(RESP == 1) %>%
group_by(ITEM) %>%
summarise(
Doğru_Yanıt_Oranı = round(mean(SCORE == 2, na.rm = TRUE), 3),
.groups = "drop"
) %>%
left_join(irt_params, by = "ITEM") %>%
select(ITEM, Doğru_Yanıt_Oranı, b, a, difficulty_group) %>%
rename(
Madde = ITEM,
`Madde Güçlüğü (b)` = b,
`Ayırt Edicilik (a)` = a,
`Zorluk Grubu` = difficulty_group
) %>%
arrange(`Madde Güçlüğü (b)`)
DT::datatable(
item_stats,
options = list(
pageLength = 10,
autoWidth = TRUE
),
rownames = FALSE,
class = "display nowrap compact",
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: left; font-weight: bold;',
'Tablo: ', htmltools::em("Madde İstatistikleri")
)
)
theta_data <- data.frame(
IDSTU = df_items$IDSTU,
theta = fscores(irt_model, method = "EAP")[, 1]
)
theta_data <- theta_data %>%
mutate(
Yetenek_Grubu = cut(theta,
breaks = c(-Inf, -0.5, 0.5, Inf),
labels = c("Düşük", "Orta", "Yüksek"))
)
DT::datatable(
theta_data,
options = list(pageLength = 10, autoWidth = TRUE),
rownames = FALSE,
class = "display nowrap compact",
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: left; font-weight: bold;',
'Tablo: ', htmltools::em("Öğrenci Yetenek Puanları (Theta)")
)
)