# diagPlot: Plot of the Deltas points from the Delta Plot method In deltaPlotR: Identification of Dichotomous Differential Item Functioning (DIF) using Angoff's Delta Plot Method

## Description

This command plots the output of the `deltaPlot` function as a diagonal plot of Deltas points. Several graphical options are available.

## Usage

 ```1 2 3 4``` ```diagPlot(x, pch = 2, pch.mult = 17, axis.draw = TRUE, thr.draw = FALSE, dif.draw = c(1,3), print.corr = FALSE, xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL,main = NULL, save.plot = FALSE, save.options = c("plot", "default", "pdf")) ```

## Arguments

 `x` an object of class `"deltaPlot"`, typically the output of the `deltaPlot` function. `pch` integer: the usual point character type for point display. Default value is 2, that is, Delta points are drawn as empty triangles. `pch.mult` integer: the typoe of point to be used for superposing onto Delta points that correspond to several items. Default value is 17, that is, full black traingles are drawn onto existing Delta plots wherein multiple items are located. `axis.draw` Logical: should the major axis be drawn? (default is `TRUE`). If so, it will be drawn as a solid line. `thr.draw` logical: should the upper and lower bounds for DIF detection be drawn? (default is `FALSE`). If `TRUE`, they will be drawn as dashed lines. `dif.draw` numeric: a vector of two integer values to specify how the DIF items should be displayed. The first component of `dif.draw` is the type of point (i.e. the usual `pch` argument) and the second component determlines the point size (i.e. the usual `cex` argument). Default values are 1 and 3, meaning that empty circles of three time the usual size are drawn around the Delta points of items flagged as DIF. `print.corr` Logical: should the sample correlation of Delta scores be printed? (default is `FALSE`). If `TRUE`, it is printed in upper-left corner of the plot. `xlim, ylim, xlab, ylab, main` either the usual plot arguments `xlim`, `ylim`, `xlab`, `ylab` and `main`, or `NULL` (default value for all arguments). If `NULL`, the X and Y axis limits are computed from the range of Delta scores, the X and Y axis labels are `"Reference group"` and `"Focal group"` respectively, and no main title is produced. `save.plot` logical: should the plot be saved in an external figure? (default is `FALSE`). `save.options` character: a vector of three components. The first component is the name of the output file, the second component is either the file path (without final "/" symbol) or `"default"` (default), and the third component is the file extension, either `"pdf"` (default) or `"jpeg"`. Ignored if `save.plot` is `FALSE`.

## Details

The results of the Delta plot method can be graphically displayed using this function. Basically the Delta plot displays the items in a scatter plot by means of their Delta points, and the major axis is drawn. Several options permit to enhance this basic plot.

The input data `x` must be a list of class `deltaPlot`, so typically the output of the `deltaPlot` function. All other argumpents are rather standard and for optimization of the graphical display.

The type of point is defined by the `cex` argument. It takes the default value 2, which means that items are displayed with empty triangles. If several items are located on exactly the same Delta point, the `pch.mult` argument defines the type of point to display bover the existing point. The default value is 17, that is, a full black triangle. In this way, multiple items located at a single Delta point can easily be located on the plot.

Two types of axes can be draw: the major axis and the upper and lower bounds for DIF detection. The major axis is drawn by default, while the upper and lower bounds are not. The major axis can be withdrawn by setting the argument `axis.draw` to `FALSE`, and the bounds can be displayed by setting the argument `thr.draw` to `TRUE`. The major axis is always drawn by a solid line, the bounds by dashed lines.

Items flagged as DIF are also clearly identified on the plot. The argument `dif.draw` defines both the type of point and the size of the point to draw over the existing Delta points (for items flagged as DIF only). The defaulkt value is `c(1,3)`, meaning that empty circles three times larger than usual are drawn.

The sample correlation between the Delta scores can also be printed, in the upper-left corner of the plot. To do this, the argument `print.corr` must be set to `TRUE`.

Finally, the function will automatically determines the X and Y axis limits and specifies default labels for X and Y axes and the main title. These can also be specified by the user, using the usual `xlim`, `ylim`, `xlab`, `ylab` and `main` arguments.

The plot can be saved in an external file, either as PDF or JPEG format. First, the argument `save.plot` must be set to `TRUE` (default is `FALSE`). Then, the name of the figure, its location and format are specified through the argument `save.options`, all as character strings. See the Examples section for further information and a practical example.

## Author(s)

David Magis
Post-doc Fellow of the National Funds for Scientific Research (FNRS, Belgium)
University of Liege
David.Magis@ulg.ac.be, http://ppw.kuleuven.be/okp/home/
Bruno Facon
Professor, Department of Psychology
Universite Lille-Nord de France
bruno.facon@univ-lille3.fr,

## References

Angoff, W. H. and Ford, S. F. (1973). Item-race interaction on a test of scholastic aptitude. Journal of Educational Measurement, 10, 95-106.

Magis, D., and Facon, B. (2012). Angoff's Delta method revisited: improving the DIF detection under small samples. British Journal of Mathematical and Statistical Psychology, 65, 302-321.

Magis, D., and Facon, B. (2013). Item purification does not always improve DIF detection: a counter-example with Angoff's Delta plot. Educational and Psychological Measurement, 73, 293-311.

Magis, D. and Facon, B. (2014). deltaPlotR: An R Package for Differential Item Functioning Analysis with Angoff's Delta Plot. Journal of Statistical Software, Code Snippets, 59(1), 1-19. URL http://www.jstatsoft.org/v59/c01/

`deltaPlot`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46``` ``` # Loading of the verbal data data(verbal) attach(verbal) # Excluding the "Anger" variable verbal <- verbal[colnames(verbal)!="Anger"] # Basic Delta plot, threshold 1.5, no item purification res <- deltaPlot(data=verbal, type="response", group=25, focal.name=1, purify=FALSE, thr=1.5) # Keeping the first 10 items to exhibit DIF data <- verbal[,c(1:10,25)] res0 <- deltaPlot(data=data, type="response", group=11, focal.name=1, purify=FALSE, thr="norm") res0 # Item 8 is flagged as DIF res1 <- deltaPlot(data=data, type="response", group=11, focal.name=1, purify=TRUE, thr="norm", purType="IPP3") res1 # Items 6, 7 and 8 flagged as DIF after 4 iterations # Delta plot, default options diagPlot(res) diagPlot(res0) diagPlot(res1) # Drawing upper and lower bounds and removing the major axis diagPlot(res, axis.draw=FALSE, thr.draw=TRUE) diagPlot(res1, axis.draw=FALSE, thr.draw=TRUE) # Modifying the type of points for all and for DIF items diagPlot(res, pch=3, dif.draw=c(2,4)) diagPlot(res1, pch=3, dif.draw=c(2,4)) # Printing the correlation and modifying the axis limits diagPlot(res, xlim=c(9,20), ylim=c(9,20), print.corr=TRUE) diagPlot(res1, xlim=c(9,17), print.corr=TRUE) # Saving the plots as PDF and JPEG files, default folder, specific names diagPlot(res, save.plot=TRUE, save.options=c("res","default","pdf")) diagPlot(res1, save.plot=TRUE, save.options=c("res1","default","jpeg")) # Modifying the results to make two items be located on the same place res2<-res1 res2\$Deltas[9,]<-res2\$Deltas[3,] diagPlot(res2) ```