Kod
library(dplyr)
library(tidyr)
library(ggplot2)
library(psych)
library(haven)
library(here)
library(flextable)
analiz <- readRDS(here("veri", "OKUL2026_analiz.rds"))
pisa <- readRDS(here("veri", "PISA2025_TR_stu.rds"))
# 25 maddelik test, eksik yanıtı olan öğrenciler çıkarıldı
test <- analiz |> select(m01:m25)
tam <- test[complete.cases(test), ]
toplam <- rowSums(tam)
nrow(tam)[1] 17289
Kod
# KR-20
kr20 <- function(x) {
# x: 0/1 puanlı madde matrisi. Döndürür: KR-20 katsayısı
x <- x[complete.cases(x), ]
k <- ncol(x)
p <- colMeans(x)
s2 <- var(rowSums(x))
k / (k - 1) * (1 - sum(p * (1 - p)) / s2)
}
kr20(tam)[1] 0.8657527