data(recogROC)
## Two-high-threshold model
s <- mptspec("2HT", .replicates = 5,
.restr = list(r1=r, r2=r, r3=r, r4=r, r5=r,
d1=d, d2=d, d3=d, d4=d, d5=d))
m1 <- mpt(s, data = ROCBroeder2009, freqvar = "exp3")
m2 <- mpt(s, data = unname(ROCreplication$y))
## Table 4
rbind(Broeder2009 = c(deviance(m1), coef(m1)),
Replication = c(deviance(m2), coef(m2)))
## Hit rate and false alarm rate
i.hit <- with(ROCBroeder2009, item == "target" & resp == "old")
i.fa <- with(ROCBroeder2009, item == "distractor" & resp == "old")
hrfa <- data.frame(
study = rep(c("Broeder2009", "Replication"), each=5),
obshr = c((m1$y/m1$n)[i.hit], (m2$y/m2$n)[i.hit]),
obsfa = c((m1$y/m1$n)[i.fa], (m2$y/m2$n)[i.fa]),
predhr = c(m1$pcat[i.hit], m2$pcat[i.hit]),
predfa = c(m1$pcat[i.fa], m2$pcat[i.fa])
)
## ROC, Figure 7
plot(obshr ~ obsfa, hrfa[hrfa$study == "Broeder2009", ],
xlim=0:1, ylim=0:1, pch=16,
main="Linear recognition ROCs?",
ylab="Hit rate", xlab="False alarm rate")
abline(0, 1, lty=2)
lines(predhr ~ predfa, hrfa[hrfa$study == "Broeder2009", ])
points(obshr ~ obsfa, hrfa[hrfa$study == "Replication", ], col = "blue")
lines(predhr ~ predfa, hrfa[hrfa$study == "Replication", ],
col = "blue")
text(0.45, 0.93, "Replication", col = "blue")
text(0.59, 0.82, "Broeder and Schuetz\n(2009, Exp. 3)")
Run the code above in your browser using DataLab