subtestLogistic {difR}R Documentation

Testing for DIF among subgroups with generalized logistic regression


Performs the Wald test to identify DIF items among a subset of groups of examinees, using the results of generalized logistic regression for all groups.


subtestLogistic(x, items, groups, alpha = 0.05)
## S3 method for class 'subLogistic'
print(x, ...)



an object of class "genLogistic", typically the output of the difGenLogistic command.


numeric or character: a vector of items to be tested. See Details.


numeric or character: a vector of groups of examinees to be compared. See Details.


numeric: the significance level (default is 0.05).


other generic parameters for the print function.


This command makes use of the results from the generalized logistic regression to perform subtests between two or more groups of examinees (Magis, Raiche, Beland and Gerard, 2010). The Wald test is used with an appropriate contrast matrix.

The subtestLogistic command requires a preliminary output of the generalized logistic regression with all groups of examinees, preferable with the difGenLogistic command. The object x is an object of class "genLogistic" from which subtests can be performed. The same DIF effect (either uniform, nonuniform, or both types) is tested among the subset of groups of examinees as the one tested with all groups. It is provided b y the argument type argument of x.

The argument items is a vector of the names of the items to be tested, or their number in the data set. A single item can be specified.

The argument groups specifies which groups of examinees are considered in this subtest routine. It is a vector of either group names or integer values. In the latter case, the reference group is specified with the 0 (zero) value, while the focal groups are set up by their rank in the x$focal.names argument. At least two groups must be specified, and all groups can be included (which leads back to the generalized logistic regression with the Wald test).

The output provides, among others, the Wald statistics, the degrees of freedom and related asymptotic p-values for each tested item, as well as the contrast matrix.


A list of class "subLogistic" with the following components:


a table with as many rows as tested items, and four columns: the item number, the Wald statistic, the degrees of freedom and the asymptotic p-value.


the contrast matrix used for testing DIF among the groups set up by groups.


the value of the items argument.


the value of the groups argument.


the value of the x$type argument.


the value of the x$purification argument.


the value of the alpha argument.


Sebastien Beland
Collectif pour le Developpement et les Applications en Mesure et Evaluation (Cdame)
Universite du Quebec a Montreal,
David Magis
Department of Psychology, University of Liege
Research Group of Quantitative Psychology and Individual Differences, KU Leuven,
Gilles Raiche
Collectif pour le Developpement et les Applications en Mesure et Evaluation (Cdame)
Universite du Quebec a Montreal,


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

Magis, D., Raiche, G., Beland, S. and Gerard, P. (2011). A logistic regression procedure to detect differential item functioning among multiple groups. International Journal of Testing, 11, 365–386. doi: 10.1080/15305058.2011.602810

See Also

difGenLogistic, genDichoDif


## Not run: 

 # Loading of the verbal data

 # Creating four groups according to gender (0 or 1) and trait anger score
 # ("Low" or "High")
 # Reference group: women with low trait anger score (<=20)
 group <- rep("WomanLow",nrow(verbal))
 group[Anger>20 & Gender==0] <- "WomanHigh"
 group[Anger<=20 & Gender==1] <- "ManLow"
 group[Anger>20 & Gender==1] <- "ManHigh"

 # New data set
 Verbal <- cbind(verbal[,1:24], group)

 # Reference group: "WomanLow"
 names <- c("WomanHigh", "ManLow", "ManHigh")

 # Testing all types of DIF with all items
 rDIF <- difGenLogistic(Verbal, group = 25, focal.names = names)
 rUDIF <- difGenLogistic(Verbal, group = 25, focal.names = names, type = "udif")
 rNUDIF <- difGenLogistic(Verbal, group = 25, focal.names = names, type = "nudif")

 # Subtests between the reference group and the first two focal groups
 # for item "S2WantShout" (item 6) and the three types of DIF
 subGroups <- c("WomanLow", "WomanHigh", "ManLow")
 subtestLogistic(rDIF, items = 6, groups = subGroups)
 subtestLogistic(rUDIF, items = 6, groups = subGroups)
 subtestLogistic(rNUDIF, items = 6, groups = subGroups) 

 # Subtests between the reference group and the first focal group
 # for items "S2WantShout" (item 6) and "S3WantCurse" (item 7)
 # (only both DIF effects)
 subGroups <- c("WomanLow", "WomanHigh")
 items1 <- c("S2WantShout", "S3WantCurse")
 items2 <- 6:7
 subtestLogistic(rDIF, items = items1, groups = subGroups)
 subtestLogistic(rDIF, items = items2, groups = subGroups)
## End(Not run)

[Package difR version 5.1 Index]