Metode CMLE untuk data dikotomi
By Harjito (titounnes)
Data dikotomis adalah adata yang didapatkan dari pengukuran yang hanya mengijinkan dua nilai (biner) yaitu nol dan satu.Contoh data dikotomi adalah skor soal multiple choice tanpa pembobotan. Untuk menganalisis data seperti ini dengan model Rasch dengan pendekatan CMLE (Conditional Maximum Likehood Estimation) menggunakan package eRm.
Apa itu CMLE
CMLE: Conditional Maximum Likelihood Estimation dikemukankan oleh Verhelst & Glas (1995). CMLE didasarkan pada pendekatan One Parameter Logistic Model (OPLM). OPML mirip dengan model 2PL, tetapi OPLM berisi indeks diskriminasi yang telah ditetapkan berdasarkan perkiraan parameter. Seperti yang dicatat oleh penulis ini, masalah yang dihadapi dalam estimasi dengan estimasi parameter diskriminasi adalah bahwa diskriminasi tidak diketahui, yang berarti bahwa skor mentah dengan pembobotan “bukan hanya statistik, dan karenanya tidak mungkin menggunakan CML sebagai metode estimasi. “(Verhelst & Glas, 1995, hlm. 217). Artinya, kecukupan “skor” dengan pembobotan dalam 2PL tidak dapat digunakan sesuai dengan cara di mana statistik yang memadai didefinisikan. Jika bobot diperhitungkan alih-alih diestimasi, seperti dalam OPLM, estimasi bersyarat dimungkinkan dan beberapa properti model Rasch dipertahankan (Verhelst, Glas & Verstralen, 1995; Verhelst & Glas, 1995). Dalam OPLM, nilai indeks diskriminasi dibatasi antara 1 dan 15. Batasan dari pendekatan ini adalah bahwa dalam praktiknya, nilai indeks diskriminasi harus diatur sebelumnya sebagai titik awal. Ini berarti beberapa jenis perkiraan diskriminasi dilibatkan jika tujuannya adalah untuk menghindarinya.
Syarat Yang harus dipenuhi untuk analisis model Rasch.
- Unidimensionality: memiliki hanya satu variabel laten
- Local independence: tidak ada asosiasi substansi anatar item dan respon
- Person-invariant item estimates: lokasi item tidak bergantung pada siapa respondennya
- Item-invariant person estimates: lokasi responden tidak bergantung pada item yang digunakan
Package yang dibutuhkan
Versi Minimum
Untuk menjalankan eRm dibutuhkan R-base minimal versi 3.5.0++. Untuk mendapatkan versi terbaru unduh versi
- windows unduh di sini
- Debian (linux) unduh di sini
- Fedora (linux) unduh di sini
- Redhat (linux) unduh di sini
- OpenSuse (linux) unduh di sini
- Ubuntu (linux) unduh di sini
- MacOs (Apple) unduh di sini
Potongan script untuk menjalankan analisis CMLE
Memeriksa versi R-base
vs = as.numeric(R.version$major)+as.numeric(R.version$minor)
if(vs < 3.5){
cat(paste("Minimun version is 3.5. Your R version is", vs,"\n"))
quit()
}
Membaca data yang akan dianalisis (format CSV)
readData <- function(path) {
return(read.csv(file = path))
}
args = commandArgs(trailingOnly=TRUE)
if(length(args)==0){
raw <- readData('sample.csv')
dirW <- "sample"
}else{
if(file.exists(args[1])){
raw <- readData(args[1])
dirW <- strsplit(args[1], ".")[0]
}else{
raw <- FALSE
cat(paste("File", args[1], "tidak ditemukan.\n"))
quit()
}
}
Menyiapkan direktori kerja (format CSV)
if(!dir.exists(dirW)){
dir.create(dirW)
}
joinPath <- function(parent, child){
return(gsub(" ", "", paste(parent,"/",child), fixed = TRUE))
}
for(d in c('log','plot')){
dd <- joinPath(dirW,d)
if(!dir.exists(dd)){
dir.create(dd)
}else{
f <- list.files(dd, include.dirs = F, full.names = T, recursive = T)
file.remove(f)
}
}
Menyimpan data log
logger <- function(path, data, sum=FALSE) {
path <- joinPath(dirW,path)
path <- gsub(" ", "_", path, fixed = TRUE)
cat(paste("Writing:",path, "...\n"))
sink(path)
cat("Data\n")
print(data)
if(sum){
cat("Summary\n")
print(summary(data))
}
sink()
}
Menyimpan hasil plot (grafik)
plotter <- function(path, data, width=600, height=350, color="", absis = 0, ordinat=0.5){
path <- joinPath(dirW,path)
path <- gsub(" ", "_", path, fixed = TRUE)
cat(paste("Drawing:",path, "...\n"))
png(path, width=width, height=height)
data
if(color!=""){
abline(v = absis, col = color)
abline(h = ordinat, col = color)
}
dev.off()
}
Instalasi package dan load package
requiredPackages = c('eRm','MASS','ltm','difR')
for(p in requiredPackages){
if(!require(p,character.only = TRUE)) install.packages(p)
library(p,character.only = TRUE)
}
Memproses data log
scores <- subset(raw, select = -c(Person, Age, Gender))
logger('log/scores.txt', scores, TRUE)
dikotomi <- RM(scores)
logger('log/analyze.txt', dikotomi, TRUE)
logger('log/difficulty.txt', -coef(dikotomi))
person <- person.parameter(dikotomi)
logger('log/reliability.txt', SepRel(person))
logger('log/anova.txt', anova(rasch(scores), ltm(scores ~ z1)))
logger('log/person_parameter.txt', IC(person))
logger('log/model_predicted_probability.txt', pmat(person))
logger('log/item_fit.txt', itemfit(person))
logger('log/person_misfit.txt', PersonMisfit(person))
andersen_split_half <- LRtest(dikotomi, splitcr = rep(1:2, each = nrow(scores)/2))
logger("log/andersen_test_split_half.txt", andersen_split_half)
andersen_split_by_mean <- LRtest(dikotomi, splitcr = "mean")
logger("log/andersen_test_split_by_mean.txt", andersen_split_by_mean)
gender <- raw$Gender
if(length(gender)>0){
mantel_hantzel <- difMH(scores, group = gender, focal.name = 1)
logger("log/Mantel-Haenszel.txt", mantel_hantzel)
dl <- difLord(scores, group = gender, focal.name = 1, model = "1PL", discr = NULL)
logger("log/dif Lord.txt", dl)
gender_efect <- LRtest(dikotomi, splitcr = gender)
logger("log/Gender Effect.txt", gender_efect)
}
Memproses Plot
div <- 12
part <- ceiling(ncol(scores)/div)
for(i in 1:part){
start <- (i-1)*div+1
finish <- i*div
if(finish > ncol(scores)){
finish <- ncol(scores)
}
path <- paste('plot/ICC ',start,'-',finish,'.png')
plotter(path, plotjointICC(dikotomi, item.subset = start:finish, cex = .6), 600, 350, "grey", 0, .5)
path <- paste('plot/DIF Split half ',start,'-',finish,'.png')
plotter(path, plotDIF(andersen_split_half, item.subset = start:finish, gamma = 0.95, main = NULL, xlim = NULL, xlab = " ", ylab="Item", col = NULL, distance=0.1, splitnames=NULL, leg = FALSE, legpos="bottomleft"),600, 600)
path <- paste('plot/DIF Split by mean ',start,'-',finish,'.png')
plotter(path, plotDIF(andersen_split_by_mean, item.subset = start:finish, gamma = 0.95, main = NULL, xlim = NULL, xlab = " ", ylab="Item", col = NULL, distance=0.1, splitnames=NULL, leg = FALSE, legpos="bottomleft"),600, 600)
path <- paste('plot/PIMap unsorted ',start,'-',finish,'.png')
plotter(path, plotPImap(dikotomi, item.subset = start:finish, sorted = FALSE, main = "Person-Item Map", latdim = "Latent Dimension", pplabel = "Person\nParameter\nDistribution", cex.gen = 0.7, xrange = NULL, warn.ord = TRUE, warn.ord.colour = "black", irug = TRUE, pp = NULL), 600, 600)
path <- paste('plot/PIMap sorted ',start,'-',finish,'.png')
plotter(path, plotPImap(dikotomi, item.subset = start:finish, sorted = TRUE, main = "Person-Item Map", latdim = "Latent Dimension", pplabel = "Person\nParameter\nDistribution", cex.gen = 0.7, xrange = NULL, warn.ord = TRUE, warn.ord.colour = "black", irug = TRUE, pp = NULL), 600, 600)
}
plotter("plot/pathway_map.png", plotPWmap(dikotomi, pp = person))
plotter("plot/plot_info.png", plotINFO(dikotomi),600, 600)
if(length(gender)>0){
plotter("plot/Mantel_Haenszel.png", plot(mantel_hantzel, message))
plotter("plot/Lord-test.png", plot(dl))
plotter("plot/gender_effect.png", plotGOF(gender_efect, conf = list(), tlab = "number", xlab = "Women", ylab = "Men"))
}
Citation
Jika anda menggunakan package eRm untuk publikasi, anda dapat menyertakan sitasi berikut.
@Manual{,
title = {{eRm: Extended Rasch Modeling}},
author = {Patrick Mair and Reinhold Hatzinger and Marco Johannes
Maier},
year = {2021},
note = {1.0-2},
url = {https://cran.r-project.org/package=eRm},
}
@Article{,
title = {{Extended Rasch modeling: The eRm package for the
application of IRT models in R}},
author = {Patrick Mair and Reinhold Hatzinger},
year = {2007},
page = {1--20},
journal = {{Journal of Statistical Software}},
volume = {20},
issue = {9},
url = {https://www.jstatsoft.org/v20/i09},
}
@Article{,
title = {{CML based estimation of extended Rasch models with the
eRm package in R}},
author = {Patrick Mair and Reinhold Hatzinger},
year = {2007},
page = {26--43},
journal = {{Psychology Science}},
volume = {49},
issue = {1},
}
@Article{,
title = {{IRT models with relaxed assumptions in eRm: A manual-like
instruction}},
author = {Reinhold Hatzinger and Thomas Rusch},
year = {2009},
page = {87--120},
journal = {{Psychology Science Quarterly}},
volume = {51},
issue = {1},
}
@InProceedings{,
title = {{Linear logistic models with relaxed assumptions in R}},
author = {Thomas Rusch and Marco Johannes Maier and Reinhold
Hatzinger},
booktitle = {{Algorithms from and for Nature and Life}},
editor = {Berthold Lausen and Dirk {van den Poel} and Alfred
Ultsch},
series = {{Studies in Classification, Data Analysis, and Knowledge
Organization}},
year = {2013},
page = {337--347},
address = {{New York}},
publisher = {{Springer}},
doi = {10.1007/978-3-319-00035-0_34},
}
@Article{,
title = {{An Empirical Power Analysis of Quasi-Exact Tests for the
Rasch Model: Measurement Invariance in Small Samples}},
author = {Ingrid Koller and Marco Johannes Maier and Reinhold
Hatzinger},
year = {2015},
volume = {11},
issue = {2},
page = {45--54},
journal = {{Methodology}},
doi = {10.1027/1614-2241/a000090},
}
@Article{,
title = {{Testing the Local Independence Assumption of the Rasch
Model With Q3-Based Nonparametric Model Tests}},
author = {Rudolf Debelak and Ingrid Koller},
year = {2019},
journal = {{Applied Psychological Measurement}},
doi = {10.1177/0146621619835501},
}
Video Tutorial
Tutorial lengkap sedang dalam produksi.
Tags:
Ikuti terus tutorial saya di e-Project dan channel
saya di