library("psychotools")
## load data and exclude extreme scorers
data("MathExam14W", package = "psychotools")
MathExam14W <- transform(MathExam14W,
points = 2 * nsolved - 0.5 * rowSums(credits == 1)
)
me <- subset(MathExam14W, nsolved > 0 & nsolved < 13)
## item response data:
## solved (correct/other) or credits (correct/incorrect/not attempted)
par(mfrow = c(1, 2))
plot(me$solved)
plot(me$credits)


## Rasch and partial credit model
ram <- raschmodel(me$solved)
pcm <- pcmodel(me$credits)
## various types of graphics displays
plot(ram, type = "profile")
plot(pcm, type = "profile", add = TRUE, col = "blue")
plot(ram, type = "piplot")
plot(pcm, type = "piplot")
plot(ram, type = "region")
plot(pcm, type = "region")
plot(ram, type = "curves")
plot(pcm, type = "curves")
## test for differential item function with automatic anchoring
## passing vs. not passing students
at1 <- anchortest(solved ~ factor(nsolved <= 7), data = me,
adjust = "single-step")
at1Anchor items:
solvedimplicit
Final DIF tests:
Simultaneous Tests for General Linear Hypotheses
Linear Hypotheses:
Estimate Std. Error z value Pr(>|z|)
solvedquad == 0 0.85410 0.24619 3.469 0.00558 **
solvedderiv == 0 0.20045 0.27595 0.726 0.99610
solvedelasticity == 0 -0.09012 0.30286 -0.298 1.00000
solvedintegral == 0 0.03707 0.25379 0.146 1.00000
solvedinterest == 0 0.11754 0.27848 0.422 0.99998
solvedannuity == 0 0.18319 0.26426 0.693 0.99742
solvedpayflow == 0 1.24651 0.29625 4.208 < 0.001 ***
solvedmatrix == 0 -0.13690 0.27036 -0.506 0.99988
solvedplanning == 0 0.48935 0.25182 1.943 0.33555
solvedequations == 0 0.33575 0.25418 1.321 0.78975
solvedhesse == 0 -0.18814 0.32586 -0.577 0.99954
solvedlagrange == 0 0.65729 0.25004 2.629 0.07369 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
plot(at1$final_tests)
## -> "good" students discriminate somewhat more
## (quad/payflow/lagrange are slightly more difficult)
## group 1 vs. group 2
at2 <- anchortest(solved ~ group, data = me, adjust = "single-step")
at2Anchor items:
solvedimplicit
Final DIF tests:
Simultaneous Tests for General Linear Hypotheses
Linear Hypotheses:
Estimate Std. Error z value Pr(>|z|)
solvedquad == 0 -2.17509 0.24979 -8.708 <0.001 ***
solvedderiv == 0 0.01490 0.25169 0.059 1.000
solvedelasticity == 0 -0.36133 0.25861 -1.397 0.745
solvedintegral == 0 -0.27888 0.24156 -1.154 0.898
solvedinterest == 0 -0.31691 0.25166 -1.259 0.839
solvedannuity == 0 0.11441 0.24627 0.465 1.000
solvedpayflow == 0 -1.50290 0.29917 -5.024 <0.001 ***
solvedmatrix == 0 0.02706 0.24553 0.110 1.000
solvedplanning == 0 -2.11072 0.25118 -8.403 <0.001 ***
solvedequations == 0 -0.04104 0.24580 -0.167 1.000
solvedhesse == 0 0.54723 0.26823 2.040 0.286
solvedlagrange == 0 -0.37795 0.24432 -1.547 0.629
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
plot(at2$final_tests)
## -> quad/payflow/planning easier for group 1
## -> hesse slightly easier for group 2
## bring out differences between groups 1 and 2
## by (anchored) item difficulty profiles
ram1 <- raschmodel(subset(me, group == "1")$solved)
ram2 <- raschmodel(subset(me, group == "2")$solved)
plot(ram1, parg = list(ref = at2$anchor_items), ylim = c(-2, 3))
plot(ram2, parg = list(ref = at2$anchor_items), add = TRUE, col = "blue")
legend("topleft", c("Group 1", "Group 2"), pch = 21,
pt.bg = c("lightgray", "blue"), bty = "n")