# Gerekli paket
#install.packages("mirt")
# Paketi çağır
library(mirt)
## Warning: package 'mirt' was built under R version 4.5.3
## Zorunlu paket yükleniyor: stats4
## Zorunlu paket yükleniyor: lattice
# Tekrarlanabilir sonuçlar için
set.seed(2026)
# Madde sayıları
ortak_madde <- 6
ozel_madde <- 14
toplam_madde <- 34
# Örneklem büyüklükleri
N1 <- 500
N2 <- 500
# Madde ayırt edicilik parametreleri
a <- matrix(runif(toplam_madde, 0.7, 2.0),
ncol = 1)
# Madde eÅŸik parametreleri
b <- matrix(
rep(c(-1.5, 0, 1.5), toplam_madde),
nrow = toplam_madde,
byrow = TRUE
)
# mirt GRM parametrelemesinde d = -a*b
d <- -a[, 1] * b
# Yetenek dağılımları
theta1 <- matrix(rnorm(N1, mean = 0, sd = 1))
theta2 <- matrix(rnorm(N2, mean = 0.5, sd = 1))
# İki grup için yanıtların üretilmesi
veri1_tam <- simdata(
a = a,
d = d,
N = N1,
itemtype = "graded",
Theta = theta1
)
veri2_tam <- simdata(
a = a,
d = d,
N = N2,
itemtype = "graded",
Theta = theta2
)
# A ve B formlarının oluşturulması
form_A <- veri1_tam[, 1:20]
form_B <- veri2_tam[, c(1:6, 21:34)]
# Veri boyutlarının kontrolü
dim(form_A)
## [1] 500 20
dim(form_B)
## [1] 500 20
# İlk birkaç gözlem
head(form_A)
## Item_1 Item_2 Item_3 Item_4 Item_5 Item_6 Item_7 Item_8 Item_9 Item_10
## [1,] 2 2 2 3 2 1 1 1 1 2
## [2,] 0 1 0 0 0 0 1 1 3 0
## [3,] 2 1 3 2 2 2 1 2 0 3
## [4,] 1 0 0 1 0 2 1 1 0 2
## [5,] 0 0 3 1 2 0 0 2 1 2
## [6,] 0 1 2 1 0 2 1 0 0 1
## Item_11 Item_12 Item_13 Item_14 Item_15 Item_16 Item_17 Item_18 Item_19
## [1,] 3 2 2 1 2 2 1 3 1
## [2,] 2 2 0 0 0 2 2 0 2
## [3,] 2 1 3 2 3 2 3 1 3
## [4,] 3 1 2 2 3 0 0 1 0
## [5,] 0 0 3 1 1 1 1 2 2
## [6,] 0 0 0 0 1 1 0 0 0
## Item_20
## [1,] 1
## [2,] 0
## [3,] 1
## [4,] 0
## [5,] 1
## [6,] 1
head(form_B)
## Item_1 Item_2 Item_3 Item_4 Item_5 Item_6 Item_21 Item_22 Item_23 Item_24
## [1,] 3 2 0 3 3 1 1 3 3 3
## [2,] 1 0 3 1 1 1 1 3 2 0
## [3,] 1 1 1 1 1 2 1 0 0 0
## [4,] 1 0 3 0 2 3 1 2 2 0
## [5,] 2 3 1 2 3 3 0 2 2 1
## [6,] 1 1 1 1 1 1 2 3 1 1
## Item_25 Item_26 Item_27 Item_28 Item_29 Item_30 Item_31 Item_32 Item_33
## [1,] 3 3 1 1 3 3 2 2 3
## [2,] 1 0 1 1 1 2 2 2 2
## [3,] 2 0 1 2 0 1 0 1 2
## [4,] 1 1 1 0 0 1 0 1 1
## [5,] 2 2 2 3 3 3 2 2 2
## [6,] 1 3 0 1 1 1 1 0 2
## Item_34
## [1,] 3
## [2,] 2
## [3,] 3
## [4,] 3
## [5,] 3
## [6,] 1
# Yanıt kategorilerinin kontrolü
table(as.vector(as.matrix(form_A)))
##
## 0 1 2 3
## 2018 2851 2981 2150
table(as.vector(as.matrix(form_B)))
##
## 0 1 2 3
## 1395 2510 3189 2906
# Eksik veri kontrolü
sum(is.na(form_A))
## [1] 0
sum(is.na(form_B))
## [1] 0
# Yetenek dağılımlarının kontrolü
mean(theta1)
## [1] 0.05868691
sd(theta1)
## [1] 1.01621
mean(theta2)
## [1] 0.4890454
sd(theta2)
## [1] 0.9576158
# A formunun GRM modeli
model_A <- mirt(
form_A,
1,
itemtype = "graded",
verbose = FALSE
)
# B formunun GRM modeli
model_B <- mirt(
form_B,
1,
itemtype = "graded",
verbose = FALSE
)
# Model sonuçları
summary(model_A)
## F1 h2
## Item_1 0.666 0.443
## Item_2 0.662 0.438
## Item_3 0.384 0.148
## Item_4 0.582 0.339
## Item_5 0.670 0.450
## Item_6 0.375 0.141
## Item_7 0.597 0.356
## Item_8 0.745 0.555
## Item_9 0.571 0.326
## Item_10 0.610 0.373
## Item_11 0.416 0.173
## Item_12 0.759 0.575
## Item_13 0.494 0.244
## Item_14 0.734 0.539
## Item_15 0.475 0.226
## Item_16 0.548 0.300
## Item_17 0.630 0.397
## Item_18 0.357 0.127
## Item_19 0.528 0.279
## Item_20 0.388 0.151
##
## SS loadings: 6.579
## Proportion Var: 0.329
##
## Factor correlations:
##
## F1
## F1 1
summary(model_B)
## F1 h2
## Item_1 0.693 0.480
## Item_2 0.665 0.442
## Item_3 0.381 0.145
## Item_4 0.512 0.262
## Item_5 0.596 0.355
## Item_6 0.411 0.169
## Item_21 0.547 0.300
## Item_22 0.549 0.302
## Item_23 0.559 0.313
## Item_24 0.397 0.157
## Item_25 0.534 0.285
## Item_26 0.489 0.239
## Item_27 0.542 0.294
## Item_28 0.437 0.191
## Item_29 0.392 0.154
## Item_30 0.692 0.479
## Item_31 0.716 0.512
## Item_32 0.474 0.225
## Item_33 0.674 0.454
## Item_34 0.299 0.090
##
## SS loadings: 5.846
## Proportion Var: 0.292
##
## Factor correlations:
##
## F1
## F1 1
#install.packages("plink", repos = "https://cloud.r-project.org")
library(plink)
## Warning: package 'plink' was built under R version 4.5.3
packageVersion("plink")
## [1] '1.5.1'
# A formu madde parametreleri
param_A <- coef(
model_A,
IRTpars = TRUE,
simplify = TRUE
)$items
# B formu madde parametreleri
param_B <- coef(
model_B,
IRTpars = TRUE,
simplify = TRUE
)$items
# İlk maddelerin parametrelerini incele
head(param_A)
## a b1 b2 b3
## Item_1 1.5178474 -1.595106 -0.097542555 1.390371
## Item_2 1.5025899 -1.275440 -0.007066944 1.440634
## Item_3 0.7080179 -2.079804 -0.076949645 1.727900
## Item_4 1.2181750 -1.485978 0.079216008 1.602763
## Item_5 1.5380452 -1.400507 0.044977769 1.375957
## Item_6 0.6894673 -1.581651 -0.109135694 1.457566
head(param_B)
## a b1 b2 b3
## Item_1 1.6347271 -2.081591 -0.5109244 0.9435992
## Item_2 1.5138416 -1.963114 -0.3850231 1.0486848
## Item_3 0.7005436 -2.519834 -0.8637155 0.9924838
## Item_4 1.0139088 -2.258725 -0.4626415 1.0643299
## Item_5 1.2620472 -2.264453 -0.6604991 1.0610260
## Item_6 0.7683177 -1.676059 -0.2233789 1.1699019
library(mirt)
library(plink)
# İki modelin parametrelerini plink formatına dönüştür
plink_pars <- mirt::read.mirt(
list(
Grup_A = model_A,
Grup_B = model_B
)
)
# Dönüşümü kontrol et
plink_pars
## $Grup_A
## An object of class "irt.pars"
## Slot "pars":
## b1 b2 b3
## [1,] 1.5178474 -1.595106 -0.097542555 1.390371
## [2,] 1.5025899 -1.275440 -0.007066944 1.440634
## [3,] 0.7080179 -2.079804 -0.076949645 1.727900
## [4,] 1.2181750 -1.485978 0.079216008 1.602763
## [5,] 1.5380452 -1.400507 0.044977769 1.375957
## [6,] 0.6894673 -1.581651 -0.109135694 1.457566
## [7,] 1.2664688 -1.678552 0.010574050 1.470930
## [8,] 1.9013300 -1.483119 0.004948859 1.481852
## [9,] 1.1849933 -1.205890 0.024197729 1.322864
## [10,] 1.3114184 -1.504529 -0.151293553 1.608193
## [11,] 0.7782186 -1.506828 -0.274897103 0.993518
## [12,] 1.9814305 -1.342762 -0.048258286 1.204355
## [13,] 0.9677377 -1.667689 -0.088009186 1.480117
## [14,] 1.8400802 -1.431472 -0.146454024 1.484220
## [15,] 0.9188266 -1.379648 -0.170647697 1.403986
## [16,] 1.1146994 -1.651187 -0.055836107 1.472854
## [17,] 1.3808638 -1.506606 -0.027498046 1.492434
## [18,] 0.6502737 -1.799668 -0.130578029 1.433195
## [19,] 1.0574425 -1.415318 0.057295360 1.536803
## [20,] 0.7168475 -1.654168 -0.060300130 1.315919
##
## Slot "cat":
## [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
##
## Slot "poly.mod":
## An object of class "poly.mod"
## Slot "model":
## [1] "grm"
##
## Slot "items":
## $grm
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
##
##
##
## Slot "common":
## NULL
##
## Slot "location":
## [1] FALSE
##
## Slot "groups":
## [1] 1
##
## Slot "dimensions":
## [1] 1
##
##
## $Grup_B
## An object of class "irt.pars"
## Slot "pars":
## b1 b2 b3
## [1,] 1.6347271 -2.081591 -0.5109244 0.9435992
## [2,] 1.5138416 -1.963114 -0.3850231 1.0486848
## [3,] 0.7005436 -2.519834 -0.8637155 0.9924838
## [4,] 1.0139088 -2.258725 -0.4626415 1.0643299
## [5,] 1.2620472 -2.264453 -0.6604991 1.0610260
## [6,] 0.7683177 -1.676059 -0.2233789 1.1699019
## [7,] 1.1132039 -1.927096 -0.3511699 0.9971603
## [8,] 1.1183641 -1.854107 -0.2341868 1.1261193
## [9,] 1.1482909 -1.897482 -0.5305734 0.8878642
## [10,] 0.7351596 -1.886319 -0.5265956 1.0380335
## [11,] 1.0736705 -2.409359 -0.6568910 1.2378743
## [12,] 0.9541065 -2.027662 -0.5364457 0.8428242
## [13,] 1.0974457 -2.207382 -0.4705327 1.0893873
## [14,] 0.8274906 -2.244381 -0.6747108 1.0423169
## [15,] 0.7248788 -2.006356 -0.5489228 0.8992397
## [16,] 1.6327956 -1.904204 -0.5716325 0.8427951
## [17,] 1.7450574 -2.011431 -0.4420826 1.0853936
## [18,] 0.9165593 -2.298230 -0.5766061 1.0470572
## [19,] 1.5521564 -2.273248 -0.6127000 1.1039969
## [20,] 0.5339886 -2.843982 -0.9439065 1.1833549
##
## Slot "cat":
## [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
##
## Slot "poly.mod":
## An object of class "poly.mod"
## Slot "model":
## [1] "grm"
##
## Slot "items":
## $grm
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
##
##
##
## Slot "common":
## NULL
##
## Slot "location":
## [1] FALSE
##
## Slot "groups":
## [1] 1
##
## Slot "dimensions":
## [1] 1
ortak <- matrix(
c(1, 1,
2, 2,
3, 3,
4, 4,
5, 5,
6, 6),
ncol = 2,
byrow = TRUE
)
ortak
## [,1] [,2]
## [1,] 1 1
## [2,] 2 2
## [3,] 3 3
## [4,] 4 4
## [5,] 5 5
## [6,] 6 6
birlesik_pars <- combine.pars(
x = plink_pars,
common = ortak,
grp.names = c("Grup_A", "Grup_B")
)
birlesik_pars
## An object of class "irt.pars"
## Slot "pars":
## $Grup_A
## b1 b2 b3
## [1,] 1.5178474 -1.595106 -0.097542555 1.390371
## [2,] 1.5025899 -1.275440 -0.007066944 1.440634
## [3,] 0.7080179 -2.079804 -0.076949645 1.727900
## [4,] 1.2181750 -1.485978 0.079216008 1.602763
## [5,] 1.5380452 -1.400507 0.044977769 1.375957
## [6,] 0.6894673 -1.581651 -0.109135694 1.457566
## [7,] 1.2664688 -1.678552 0.010574050 1.470930
## [8,] 1.9013300 -1.483119 0.004948859 1.481852
## [9,] 1.1849933 -1.205890 0.024197729 1.322864
## [10,] 1.3114184 -1.504529 -0.151293553 1.608193
## [11,] 0.7782186 -1.506828 -0.274897103 0.993518
## [12,] 1.9814305 -1.342762 -0.048258286 1.204355
## [13,] 0.9677377 -1.667689 -0.088009186 1.480117
## [14,] 1.8400802 -1.431472 -0.146454024 1.484220
## [15,] 0.9188266 -1.379648 -0.170647697 1.403986
## [16,] 1.1146994 -1.651187 -0.055836107 1.472854
## [17,] 1.3808638 -1.506606 -0.027498046 1.492434
## [18,] 0.6502737 -1.799668 -0.130578029 1.433195
## [19,] 1.0574425 -1.415318 0.057295360 1.536803
## [20,] 0.7168475 -1.654168 -0.060300130 1.315919
##
## $Grup_B
## b1 b2 b3
## [1,] 1.6347271 -2.081591 -0.5109244 0.9435992
## [2,] 1.5138416 -1.963114 -0.3850231 1.0486848
## [3,] 0.7005436 -2.519834 -0.8637155 0.9924838
## [4,] 1.0139088 -2.258725 -0.4626415 1.0643299
## [5,] 1.2620472 -2.264453 -0.6604991 1.0610260
## [6,] 0.7683177 -1.676059 -0.2233789 1.1699019
## [7,] 1.1132039 -1.927096 -0.3511699 0.9971603
## [8,] 1.1183641 -1.854107 -0.2341868 1.1261193
## [9,] 1.1482909 -1.897482 -0.5305734 0.8878642
## [10,] 0.7351596 -1.886319 -0.5265956 1.0380335
## [11,] 1.0736705 -2.409359 -0.6568910 1.2378743
## [12,] 0.9541065 -2.027662 -0.5364457 0.8428242
## [13,] 1.0974457 -2.207382 -0.4705327 1.0893873
## [14,] 0.8274906 -2.244381 -0.6747108 1.0423169
## [15,] 0.7248788 -2.006356 -0.5489228 0.8992397
## [16,] 1.6327956 -1.904204 -0.5716325 0.8427951
## [17,] 1.7450574 -2.011431 -0.4420826 1.0853936
## [18,] 0.9165593 -2.298230 -0.5766061 1.0470572
## [19,] 1.5521564 -2.273248 -0.6127000 1.1039969
## [20,] 0.5339886 -2.843982 -0.9439065 1.1833549
##
##
## Slot "cat":
## $Grup_A
## [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
##
## $Grup_B
## [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
##
##
## Slot "poly.mod":
## $Grup_A
## An object of class "poly.mod"
## Slot "model":
## [1] "grm"
##
## Slot "items":
## $grm
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
##
##
##
## $Grup_B
## An object of class "poly.mod"
## Slot "model":
## [1] "grm"
##
## Slot "items":
## $grm
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
##
##
##
##
## Slot "common":
## Grup_A Grup_B
## [1,] 1 1
## [2,] 2 2
## [3,] 3 3
## [4,] 4 4
## [5,] 5 5
## [6,] 6 6
##
## Slot "location":
## [1] FALSE FALSE
##
## Slot "groups":
## [1] 2
##
## Slot "dimensions":
## [1] 1 1
sonuc <- plink(
birlesik_pars,
method = c("MM", "MS", "HB", "SL"),
base.grp = 1
)
# Bağlantı sabitleri
baglanti_sabitleri <- link.con(sonuc)
print(baglanti_sabitleri)
## A B
## Mean/Mean 0.960866 0.479157
## Mean/Sigma 0.964465 0.481075
## Haebara 0.943609 0.488286
## Stocking-Lord 0.959908 0.481138
# Gerçek bağlantı sabitleri
A_gercek <- 1
B_gercek <- 0.5
# Bağlantı sonuçları
sonuc_tablosu <- data.frame(
Yontem = rownames(baglanti_sabitleri),
A = baglanti_sabitleri[, "A"],
B = baglanti_sabitleri[, "B"]
)
# Mutlak hatalar
sonuc_tablosu$A_Hata <- abs(
sonuc_tablosu$A - A_gercek
)
sonuc_tablosu$B_Hata <- abs(
sonuc_tablosu$B - B_gercek
)
# Ortalama mutlak hata
sonuc_tablosu$Ortalama_Hata <- (
sonuc_tablosu$A_Hata +
sonuc_tablosu$B_Hata
) / 2
print(sonuc_tablosu)
## Yontem A B A_Hata B_Hata Ortalama_Hata
## Mean/Mean Mean/Mean 0.960866 0.479157 0.039134 0.020843 0.0299885
## Mean/Sigma Mean/Sigma 0.964465 0.481075 0.035535 0.018925 0.0272300
## Haebara Haebara 0.943609 0.488286 0.056391 0.011714 0.0340525
## Stocking-Lord Stocking-Lord 0.959908 0.481138 0.040092 0.018862 0.0294770
# Stocking-Lord yöntemiyle ölçek dönüşümü ve yeniden ölçeklenmiş (rescaled) parametreler
puan_esitleme <- plink(
x = birlesik_pars,
common = ortak,
rescale = "SL",
method = "SL",
base.grp = 1
)
# Dönüşüm katsayıları ve yakınsama özeti
puan_esitleme$link
## An object of class "link"
## Slot "constants":
## $SL
## A B
## 0.959908 0.481138
##
##
## Slot "descriptives":
## $grm
## a b
## N Pars: 6.000000 18.000000
## Mean: To 1.195690 -0.032767
## Mean: From 1.148898 -0.532774
## SD: To 0.367372 1.264143
## SD: From 0.352633 1.310720
##
## $all
## a b
## N Pars: 6.000000 18.000000
## Mean: To 1.195690 -0.032767
## Mean: From 1.148898 -0.532774
## SD: To 0.367372 1.264143
## SD: From 0.352633 1.310720
##
##
## Slot "iterations":
## SL
## 8
##
## Slot "objective":
## SL
## 0.001130803
##
## Slot "convergence":
## SL
## "both X-convergence and relative convergence (5)"
##
## Slot "base.grp":
## [1] 1
##
## Slot "n":
## Total Dichot Poly
## 6 0 6
##
## Slot "grp.names":
## [1] "Grup_B/Grup_A*"
##
## Slot "mod.lab":
## [1] "Graded Response Model"
##
## Slot "dilation":
## [1] "N/A"
# Form B'nin Grup A ölçeğine dönüştürülmüş GRM parametreleri (ilk 10 madde)
head(puan_esitleme$pars@pars$Grup_B, 10)
## b1 b2 b3
## [1,] 1.7030039 -1.516997 -0.009302436 1.386906
## [2,] 1.5770695 -1.403271 0.111551282 1.487779
## [3,] 0.7298029 -1.937670 -0.347949409 1.433831
## [4,] 1.0562563 -1.687030 0.037044763 1.502797
## [5,] 1.3147585 -1.692528 -0.152880342 1.499625
## [6,] 0.8004077 -1.127724 0.266714789 1.604136
## [7,] 1.1596985 -1.368697 0.144047180 1.438320
## [8,] 1.1650742 -1.298634 0.256340250 1.562109
## [9,] 1.1962510 -1.340270 -0.028163670 1.333406
## [10,] 0.7658647 -1.329555 -0.024345356 1.477555
# Dönüştürülmüş kategori sınır karakteristik eğrileri (OCC)
plot(puan_esitleme)


# 1. Puan eşitleme tablosunu çek (plink paketinde 'equate' bileşeni altındadır)
esit_puan_df <- as.data.frame(puan_esitleme$equate)
head(esit_puan_df, 15)
## data frame with 0 columns and 0 rows
# 2. Dönüşüm eğrisi grafiği (1. ve 2. sütunları indeksle alarak hata riskini sıfırlar)
library(plink)
# Stocking-Lord yöntemiyle ölçek dönüşümü ve yeniden ölçeklenmiş parametreler
puan_esitleme <- plink(
x = birlesik_pars,
common = ortak,
rescale = "SL",
method = "SL",
base.grp = 1
)
# Dönüşüm katsayıları ve yakınsama özeti
puan_esitleme$link
## An object of class "link"
## Slot "constants":
## $SL
## A B
## 0.959908 0.481138
##
##
## Slot "descriptives":
## $grm
## a b
## N Pars: 6.000000 18.000000
## Mean: To 1.195690 -0.032767
## Mean: From 1.148898 -0.532774
## SD: To 0.367372 1.264143
## SD: From 0.352633 1.310720
##
## $all
## a b
## N Pars: 6.000000 18.000000
## Mean: To 1.195690 -0.032767
## Mean: From 1.148898 -0.532774
## SD: To 0.367372 1.264143
## SD: From 0.352633 1.310720
##
##
## Slot "iterations":
## SL
## 8
##
## Slot "objective":
## SL
## 0.001130803
##
## Slot "convergence":
## SL
## "both X-convergence and relative convergence (5)"
##
## Slot "base.grp":
## [1] 1
##
## Slot "n":
## Total Dichot Poly
## 6 0 6
##
## Slot "grp.names":
## [1] "Grup_B/Grup_A*"
##
## Slot "mod.lab":
## [1] "Graded Response Model"
##
## Slot "dilation":
## [1] "N/A"
# Form B'nin Grup A ölçeğine dönüştürülmüş GRM parametreleri (ilk 10 madde)
head(puan_esitleme$pars@pars$Grup_B, 10)
## b1 b2 b3
## [1,] 1.7030039 -1.516997 -0.009302436 1.386906
## [2,] 1.5770695 -1.403271 0.111551282 1.487779
## [3,] 0.7298029 -1.937670 -0.347949409 1.433831
## [4,] 1.0562563 -1.687030 0.037044763 1.502797
## [5,] 1.3147585 -1.692528 -0.152880342 1.499625
## [6,] 0.8004077 -1.127724 0.266714789 1.604136
## [7,] 1.1596985 -1.368697 0.144047180 1.438320
## [8,] 1.1650742 -1.298634 0.256340250 1.562109
## [9,] 1.1962510 -1.340270 -0.028163670 1.333406
## [10,] 0.7658647 -1.329555 -0.024345356 1.477555
# Dönüştürülmüş kategori sınır karakteristik eğrileri (OCC)
plot(puan_esitleme)

