#FIRST GRAPHIC pisa <- read.table(".../pisa.txt",header=T,sep="\t", quote="") #Use of ltm package for Rasch analysis des<-descript(pisa) m1<-rasch(pisa, constraint =cbind(length(pisa) +1, 1)) abil1<-c(-1.675, -1.3, -0.951, -0.621, -0.3, -0.016, 0.331, 0.652, 0.982, 1.326, 1.69, 2.085) #MV #Vector for the boundaries of the total score anzahl_tot<-rep(0, 13) for(i in 2:13){ anzahl_tot[i] = anzahl_tot[i-1] + des$items[15-i]} #Ordering of item difficulties dffclt_1_ord<-coef(m1, order = T) #Matrix definition matxv<-matrix(nrow=317, ncol = 13, dimnames=(list(c(1:317), c("Item.38", "Item.73", "Item.6", "Item.8", "Item.39", "Item.67", "Item.37", "Item.5", "Item.64", "Item.7", "Item.72", "Item.75","Summe")))) matxhelp<-matrix(nrow=317, ncol = 13, dimnames=(list(c(1:317), c("Item.38", "Item.73", "Item.6", "Item.8", "Item.39", "Item.67", "Item.37", "Item.5", "Item.64", "Item.7", "Item.72", "Item.75","Summe")))) #Sorting of the matrix matxv[,1]<-pisa[,6] matxv[,2]<-pisa[,11] matxv[,3]<-pisa[,2] matxv[,4]<-pisa[,4] matxv[,5]<-pisa[,7] matxv[,6]<-pisa[,9] matxv[,7]<-pisa[,5] matxv[,8]<-pisa[,1] matxv[,9]<-pisa[,8] matxv[,10]<-pisa[,3] matxv[,11]<-pisa[,10] matxv[,12]<-pisa[,12] mtrans<-transform(matxv[,1:12]) mtrans<-mtrans[do.call(order, mtrans),] for(i in 1:317){ for(j in 1:12){ matxv[i,j]<-mtrans[i,j] } matxv[i,13]<-sum(mtrans[i,]) } scoresort<-rank(matxv[,13],ties.method = c("first")) for(i in 1:317){ matxhelp[scoresort[i],]<-matxv[i,] } for(i in 1:317){ matxv[i,]<-matxhelp[i,] } #Creating of matrix visualization plot(c(1,1), xlim = c(1,317), ylim = c(1,12), ylab = "Items", xlab = "Persons", type = "n", xaxt = "n") axis(1, at = anzahl_tot) for(i in 1:317){ for(j in 1:12){ if(matxv[i,j] == 1){ if(exp(abil1[matxv[i,13]] - dffclt_1_ord[13-j])/(1+exp(abil1[matxv[i,13]] - dffclt_1_ord[13-j])) < 0.15){ points(318-i,13-j,pch = 19, col = "red") } if(exp(abil1[matxv[i,13]] - dffclt_1_ord[13-j])/(1+exp(abil1[matxv[i,13]] - dffclt_1_ord[13-j])) >= 0.15){ if(matxv[i,13] == 12){ points(318-i,13-j,pch = 20, col = rgb(0,0,0.5))} if(matxv[i,13] == 11){ points(318-i,13-j,pch = 20, col = rgb(0,0,1))} if(matxv[i,13] == 10){ points(318-i,13-j,pch = 20, col = rgb(0.25,0.4,1))} if(matxv[i,13] == 9){ points(318-i,13-j,pch = 20, col = rgb(0,0.2,1))} if(matxv[i,13] == 8){ points(318-i,13-j,pch = 20, col = rgb(0,0.6,1))} if(matxv[i,13] == 7){ points(318-i,13-j,pch = 20, col = rgb(0.25,0.8,1))} if(matxv[i,13] == 6){ points(318-i,13-j,pch = 20, col = rgb(0,1,1))} if(matxv[i,13] == 5){ points(318-i,13-j,pch = 20, col = rgb(0.25,1,0.8))} if(matxv[i,13] == 4){ points(318-i,13-j,pch = 20, col = rgb(0,1,0.6))} if(matxv[i,13] == 3){ points(318-i,13-j,pch = 20, col = rgb(0.25,1,0.4))} if(matxv[i,13] == 2){ points(318-i,13-j,pch = 20, col = rgb(0,1,0.2))} if(matxv[i,13] == 1){ points(318-i,13-j,pch = 20, col = rgb(0.5,1,0))} } } if(matxv[i,j] == 0){ if(1 / (1+exp(abil1[matxv[i,13]] - dffclt_1_ord[13-j])) < 0.15){ points(318-i,13-j,pch = 19, col = "red") } } } } #SECOND GRAPHIC pisa2 <- read.table(".../pisa2.txt",header=T,sep="\t", quote="") des2<-descript(pisa2) m2<-rasch(pisa2, constraint =cbind(length(pisa2) +1, 1)) abil2<-c(-2.80,-2.56,-2.34,-2.14,-1.95,-1.77,-1.60,-1.43,-1.27,-1.12,-0.97,-0.82,-0.67,-0.53,-0.38,-0.24,-0.09,0.05,0.20,0.35, 0.50,0.66,0.82,0.99,1.16,1.34,1.53,1.73,1.95,2.19,2.46,2.75) #MV #Vector for the boundaries of the total score anzahl_tot2<-rep(0, 33) for(i in 2:33){ anzahl_tot2[i] = anzahl_tot2[i-1] + des2$items[35-i]} dffclt_2_ord<-coef(m2, order = T) matxv<-matrix(nrow=340, ncol = 33, dimnames=(list(c(1:340), c(1:33)))) matxhelp<-matrix(nrow=340, ncol = 33, dimnames=(list(c(1:340), c(1:33)))) matxv[,1]<-pisa2[,21] matxv[,2]<-pisa2[,10] matxv[,3]<-pisa2[,9] matxv[,4]<-pisa2[,8] matxv[,5]<-pisa2[,31] matxv[,6]<-pisa2[,30] matxv[,7]<-pisa2[,11] matxv[,8]<-pisa2[,6] matxv[,9]<-pisa2[,16] matxv[,10]<-pisa2[,2] matxv[,11]<-pisa2[,13] matxv[,12]<-pisa2[,25] matxv[,13]<-pisa2[,19] matxv[,14]<-pisa2[,24] matxv[,15]<-pisa2[,5] matxv[,16]<-pisa2[,12] matxv[,17]<-pisa2[,1] matxv[,18]<-pisa2[,26] matxv[,19]<-pisa2[,23] matxv[,20]<-pisa2[,29] matxv[,21]<-pisa2[,20] matxv[,22]<-pisa2[,32] matxv[,23]<-pisa2[,28] matxv[,24]<-pisa2[,7] matxv[,25]<-pisa2[,27] matxv[,26]<-pisa2[,4] matxv[,27]<-pisa2[,3] matxv[,28]<-pisa2[,22] matxv[,29]<-pisa2[,15] matxv[,30]<-pisa2[,17] matxv[,31]<-pisa2[,18] matxv[,32]<-pisa2[,14] mtrans<-transform(matxv[,1:32]) mtrans<-mtrans[do.call(order, mtrans),] for(i in 1:340){ for(j in 1:32){ matxv[i,j]<-mtrans[i,j] } matxv[i,33]<-sum(mtrans[i,]) } scoresort<-rank(matxv[,33],ties.method = c("first")) for(i in 1:340){ matxhelp[scoresort[i],]<-matxv[i,] } for(i in 1:340){ matxv[i,]<-matxhelp[i,] } plot(c(1,1), xlim = c(1,340), ylim = c(1,32), ylab = "Items", xlab = "Persons", type = "n", xaxt = "n") axis(1, at = anzahl_tot2) for(i in 1:340){ for(j in 1:32){ if(matxv[i,j] == 1){ if(exp(abil2[matxv[i,33]] - dffclt_2_ord[33-j])/(1+exp(abil2[matxv[i,33]] - dffclt_2_ord[33-j])) < 0.1){ points(341-i,33-j,pch = 19, col = "red") } if(exp(abil2[matxv[i,33]] - dffclt_2_ord[33-j])/(1+exp(abil2[matxv[i,33]] - dffclt_2_ord[33-j])) >= 0.1){ if(matxv[i,33] == 32){ points(341-i,33-j,pch = 20, col = "grey99")} if(matxv[i,33] == 31){ points(341-i,33-j,pch = 20, col = "grey96")} if(matxv[i,33] == 30){ points(341-i,33-j,pch = 20, col = "grey93")} if(matxv[i,33] == 29){ points(341-i,33-j,pch = 20, col = "grey90")} if(matxv[i,33] == 28){ points(341-i,33-j,pch = 20, col = "grey87")} if(matxv[i,33] == 27){ points(341-i,33-j,pch = 20, col = "grey84")} if(matxv[i,33] == 26){ points(341-i,33-j,pch = 20, col = "grey81")} if(matxv[i,33] == 25){ points(341-i,33-j,pch = 20, col = "grey78")} if(matxv[i,33] == 24){ points(341-i,33-j,pch = 20, col = "grey75")} if(matxv[i,33] == 23){ points(341-i,33-j,pch = 20, col = "grey72")} if(matxv[i,33] == 22){ points(341-i,33-j,pch = 20, col = "grey69")} if(matxv[i,33] == 21){ points(341-i,33-j,pch = 20, col = "grey66")} if(matxv[i,33] == 20){ points(341-i,33-j,pch = 20, col = "grey63")} if(matxv[i,33] == 19){ points(341-i,33-j,pch = 20, col = "grey60")} if(matxv[i,33] == 18){ points(341-i,33-j,pch = 20, col = "grey57")} if(matxv[i,33] == 17){ points(341-i,33-j,pch = 20, col = "grey54")} if(matxv[i,33] == 16){ points(341-i,33-j,pch = 20, col = "grey51")} if(matxv[i,33] == 15){ points(341-i,33-j,pch = 20, col = "grey48")} if(matxv[i,33] == 14){ points(341-i,33-j,pch = 20, col = "grey45")} if(matxv[i,33] == 13){ points(341-i,33-j,pch = 20, col = "grey42")} if(matxv[i,33] == 12){ points(341-i,33-j,pch = 20, col = "grey39")} if(matxv[i,33] == 11){ points(341-i,33-j,pch = 20, col = "grey36")} if(matxv[i,33] == 10){ points(341-i,33-j,pch = 20, col = "grey33")} if(matxv[i,33] == 9){ points(341-i,33-j,pch = 20, col = "grey30")} if(matxv[i,33] == 8){ points(341-i,33-j,pch = 20, col = "grey27")} if(matxv[i,33] == 7){ points(341-i,33-j,pch = 20, col = "grey24")} if(matxv[i,33] == 6){ points(341-i,33-j,pch = 20, col = "grey21")} if(matxv[i,33] == 5){ points(341-i,33-j,pch = 20, col = "grey18")} if(matxv[i,33] == 4){ points(341-i,33-j,pch = 20, col = "grey15")} if(matxv[i,33] == 3){ points(341-i,33-j,pch = 20, col = "grey12")} if(matxv[i,33] == 2){ points(341-i,33-j,pch = 20, col = "grey9")} if(matxv[i,33] == 1){ points(341-i,33-j,pch = 20, col = "grey6")} } } if(matxv[i,j] == 0){ if(1 / (1+exp(abil2[matxv[i,33]] - dffclt_2_ord[33-j])) < 0.1){ points(341-i,33-j,pch = 19, col = "red") } } } }