Learn R Programming

ShinyItemAnalysis (version 1.3.4)

ggWrightMap: Wright Map using ggplot

Description

This function allows to generate Wright Map (also called item-person map) using ggplot function from package ggplot2 and plot_grid function from cowplot. Wright Map is used to display histogram of factor scores and the item difficulty parameters estimated by the Rasch IRT model.

Usage

ggWrightMap(theta, b, binwidth = 0.5, color = "blue", size = 15, item.names)

Arguments

theta

numeric: vector of ability estimates.

b

numeric: vector of difficulty estimates.

binwidth

numeric: the width of the bins of histogram.

color

character: color of histogram.

size

text size in pts.

item.names

names of items to be displayed.

References

Wright, B. D., & Stone, M. H. (1979). Best test design.

Examples

Run this code
# NOT RUN {
library(mirt)

# loading 100-item medical admission test data sets
data(dataMedical)
# binary data set
dataBin <- dataMedical[, 1:100]

# fit Rasch model with mirt package
fit <- mirt(dataBin, model = 1, itemtype = "Rasch")
# factor scores
theta <- as.vector(fscores(fit))
# difficulty estimates
b <- coef(fit, simplify = TRUE)$items[, "d"]

ggWrightMap(theta, b)

item.names <- paste("Item", 1:20)
ggWrightMap(theta, b, item.names = item.names)
# }

Run the code above in your browser using DataLab