# NOT RUN {
# data generation
library(ggplot2)
library(reshape2)
library(dplyr)
data <- irt_model("3pl")$gendata(500, 50)
# Estimate people parameters: MLE
x.mle <- estimate_people(data$responses, data$items, "3pl", "mle")
# Estimate people parameters: MAP
x.map <- estimate_people(data$responses, data$items, "3pl", "map")
# Estimate people parameters: EAP
x.eap <- estimate_people(data$responses, data$items, "3pl", "eap")
# Comparison with true parameters
x <- data.frame(true=data$people$theta, mle=x.mle$people$theta,
map=x.map$people$theta, eap=x.eap$people$theta)
round(t(apply(x, 2, function(v) c(R=cor(v, x$true), RMSE=rmse(v, x$true)))), 2)
melt(x, id.vars="true") %>%
ggplot(aes(x=true, y=value, color=variable)) + geom_point(pch=1) +
facet_wrap(~variable, nrow=2) + xlab("True") + ylab("Est.") +
theme_bw() + theme(legend.key=element_blank())
# }
Run the code above in your browser using DataLab