library(mirt)
# fit Rasch model with the mirt package
fit <- mirt(HCI[, 1:20], model = 1, itemtype = "Rasch")
# factor scores
theta <- as.vector(fscores(fit))
# difficulty estimates using IRT parametrization
b <- coef(fit, simplify = TRUE, IRTpars = TRUE)$items[, "b"]
# Wright map
ggWrightMap(theta, b)
# Wright map with modified item names
item.names <- paste("Item", 1:20)
ggWrightMap(theta, b, item.names = item.names)
# Wright map with modified descriptions of y-axis and relative widths of plots
ggWrightMap(theta, b,
ylab.theta = "Latent trait", ylab.b = "Difficulty estimates",
rel_widths = c(2, 1)
)
Run the code above in your browser using DataLab