contrastMatrix {difR} | R Documentation |

## Contrast matrix for computing generalized Lord's chi-squared DIF statistic

### Description

This command sets the appropriate contrast matrix C for computing the generalized Lord's chi-squared statistics in the framework of DIF detection among multiple groups.

### Usage

```
contrastMatrix(nrFocal, model)
```

### Arguments

`nrFocal` |
numeric: the number of focal groups. |

`model` |
character: the logistic model to be fitted (either |

### Details

The contrast matrix C is necessary to calculate the generalized Lord's chi-squared statistic. It is designed to perform accurate tests of equality of item parameters
accross the groups of examinees (see Kim, Cohen and Park, 1995). This is a subroutine for the command `genLordChi2`

which returns the DIF statistics.

The number of focal groups has to be specified by the argument `nrFocal`

. Moreover, four logistic IRT models can be considered: the 1PL, 2PL and 3PL models
can be set by using their acronyms (e.g. `"1PL"`

for 1PL model, and so on). It is also possible to consider the constrained 3PL model, where all
pseudo-guessing values are equal across the groups of examinees and take some predefined values which do not need to be supplied here. This model is specified by
the value `"3PLc"`

for argument `model`

.

### Value

A contrast matrix designed to test equality of item parameter estimates from the specified `model`

and with `nrFocal`

focal groups. The output matrix has
a number of rows equal to `nrFocal`

times the number of tested parameters (one for 1PL model, two for 2PL and constrained 3PL models, three for 3PL model). The
number of columns is equal to (`nrFocal`

+1) times the number of tested parameters. See Kim, Cohen and Park (1995) for further details.

### Author(s)

Sebastien Beland

Collectif pour le Developpement et les Applications en Mesure et Evaluation (Cdame)

Universite du Quebec a Montreal

sebastien.beland.1@hotmail.com, http://www.cdame.uqam.ca/

David Magis

Department of Psychology, University of Liege

Research Group of Quantitative Psychology and Individual Differences, KU Leuven

David.Magis@uliege.be, http://ppw.kuleuven.be/okp/home/

Gilles Raiche

Collectif pour le Developpement et les Applications en Mesure et Evaluation (Cdame)

Universite du Quebec a Montreal

raiche.gilles@uqam.ca, http://www.cdame.uqam.ca/

### References

Kim, S.-H., Cohen, A.S. and Park, T.-H. (1995). Detection of differential item functioning in multiple groups. *Journal of Educational Measurement, 32*, 261-276. doi: 10.1111/j.1745-3984.1995.tb00466.x

Magis, D., Beland, S., Tuerlinckx, F. and De Boeck, P. (2010). A general framework and an R package for the detection
of dichotomous differential item functioning. *Behavior Research Methods, 42*, 847-862. doi: 10.3758/BRM.42.3.847

### See Also

### Examples

```
## Not run:
# Contrast matrices with 1PL model and several focal groups
contrastMatrix(2, "1PL")
contrastMatrix(3, "1PL")
contrastMatrix(4, "1PL")
# Contrast matrices with 2PL, constrained and unconstrained 3PL models and three
# focal groups
contrastMatrix(3, "2PL")
contrastMatrix(3, "3PLc")
contrastMatrix(3, "3PL")
## End(Not run)
```

*difR*version 5.1 Index]