The difPlot function is a flexible utility used to create publication-quality graphics for examining Differential Item Functioning in dichotomous item models. This function also provides several useful utilities to facilitate graphic creation. The general flow of tasks within the function is as follows:

Getting Started

Essential

difPlot is part of the irtPlot package available on github. To download the package, install the devtools package and run the following lines:

library(devtools)
install_github("ppanko/irtPlot")

Before using the difPlot function, the user must provide three arguments. First, the user must declare a data set for which he or she wishes to create graphics. Second, a sequence of theta values should be selected in order to plot the parameters (not necessary for "lmr"). Lastly, the grouping variable should be declared as a factor.

In the example below, the data are drawn from difR package and the theta values are chosen accordingly using the seq function, while the grouping variable is set to "Gender".

library(irtPlot)

data(verbal)
data <- verbal[,1:2]
group <- factor(verbal[,"Gender"]) 
levels(group) <- c("Male", "Female")
theta <- seq(-3,3, 0.01)

Next, the user must choose which model and type to plot. This function currently only supports "1PL" and "2PL" models with "3PL" in development. Plot type has one option, [Item Characteristic Curves] (#icc)"icc". See relevant sections below for more information on types.

Note: to reduce clutter for "icc" type plots, difPlot creates a separate graphic for each item. Subsequent to running the polyPlot function, a new device will be opened to display the plots. After the user presses Enter or clicks on the screen using the left mouse button, the first plot will be printed to the device along with its corresponding plot number printed in the terminal.

In the current example, difPlot will first print the "Curse" item along with a [[1]] in the terminal. After the user continues to the next plot either by clicking or pressing Enter, the "Scold" item will be displayed in the device with a corresponding [[2]]

Options

Having dispensed with the required arguments, the user is free to select a number of optional commands to personalize the desired plot. Most of the the arguments in this section are used to tweak default setting for the save utility.

  • ddir: A character string specifying the directory in which to save plots. Default is the current working directory.

  • save: A logical value specifying whether or not to save the resultant graphics. Requires TRUE/FALSE; default is FALSE.

  • title: A character string to specify the name of the plot. Default behavior is to specify the plot type and the number of items in the model.

  • filename: A character string indicating the desired filename for the saved plot. The default filename is based on the model and type arguments.

  • dpi: An integer value specifying the resolution of the saved graphic. Default value is 300; recommended value for standard poster-size figures is 600.

  • width: A numeric value for the desired width of the figure in inches. Default is 8.5 inches.

  • height: A numeric value for the desired height of the figure in inches. Default is 10 inches.

  • itmNam: A vector of character strings specifying the name of the items displayed in the legend. Default values are the names of the columns in the specified data set.

  • silent: A logical value specifying whether or not to print graphics to screen. This feature is primarily used when the user simply wants to save a plot without examining it. Default is FALSE.

The user is encouraged to view the help files using the ?difPlot function.

I. Item & Test Charactersitic Curves

Differential Item Functioning (DIF) may manifest itself as a group difference in the probability of answering a given item correctly across a range of ability values. Visually examining the difference may aid user conceptualization of the hypothesized DIF. The following formula demonstrates the 2PL probability of a correct answer for ability s on item i, which is estimated for both groups:

$$P(Y_{is}=1|\theta_s) = \frac{exp(1.7a_i(\theta_s - b_i))}{1 + exp(1.7a_i(\theta_s - b_i))}$$

Examples of the difference in the Item Characteristic Curves between Gender for "2PL" model of the verbal items are shown below. The argument itmNam is used to shorten the names of the items for aesthetic appeal.

Back to top \ Next Section


difPlot(data, theta, grp = group, model = "2PL", type = "icc", itmNam = c("Curse", "Scold"))

II. DIF Statistics

This prototype function allows the user to plot three different DIF-related statistics for simultaneous examination. The Statistics are Lord's $\chi^2$ (L), Raju's Distance (R) and the Mantel-Haenszel odds ratio (M). Each statistic is plotted concurrently with its critical value shown as a horizontal dotted line.

The example below shows the values of each of the three statistics across 6 items from the verbal data set.

  • Please note, this function is still under testing.

Previous Section \ Back to top \ Next Section


data <- verbal[,3:8]
group <- factor(verbal[,"Gender"])
difPlot(data, grp = group, model = "2PL", type = "lmr", itmNam = paste0("Itm", 1:6))

References

Embertson, S.E., & Reise, S. P. (2000). Item Response Theory for Psychologists. Hillsdale, NJ: Erlbaum.

Holland, P. W., & Thayer, D. T. (1988). Differential item performance and the Mantel-Haenszel procedure. Test validity, 129-145.

Lee, J. (2016). Lectures on Item Response Theory. Personal Collection of J. Lee, Texas Tech University, Lubbock, TX.

Lord, F. M. (1980). Applications of item response theory to practical testing problems. Routledge.

Magis, D., Beland, S., & Raiche, G. (2015). difR: Collection of methods to detect dichotomous differential item functioning (DIF). R package version 4.6

Raju, N. S. (1990). Determining the significance of estimated signed and unsigned areas between two item response functions. Applied Psychological Measurement, 14(2), 197-207.

Rizopoulos D. (2006). ltm: An R package for Latent Variable Modelling and Item Response Theory Analyses. Journal of Statistical Software, 17(5), 1-25. URL http://www.jstatsoft.org/v17/i05/

Wickham, H. (2009). ggplot2: Elegant Graphics for Data Analysis. New York: Springer-Verlag.

See Also

  • irtPlot
  • polyPlot

Back to top

Please leave comments at the project repository: https://www.github.com/ppanko/irtPlot



ppanko/irtPlot documentation built on May 25, 2019, 11:24 a.m.