genLogistik {difR}R Documentation

Generalized logistic regression DIF statistic


Calculates the "generalized logistic regression" likelihood-ratio or Wald statistics for DIF detection among multiple groups.


genLogistik(data, member, match = "score", anchor = 1:ncol(data), 
 	type = "both", criterion = "LRT") 



numeric: the data matrix (one row per subject, one column per item).


numeric: the vector of group membership with zero and positive integer entries only. See Details.


specifies the type of matching criterion. Can be either "score" (default) to compute the test score, or any continuous or discrete variable with the same length as the number of rows of data. See Details.


a vector of integer values specifying which items (all by default) are currently considered as anchor (DIF free) items. See Details.


a character string specifying which DIF effects must be tested. Possible values are "both" (default), "udif" and "nudif". See Details.


character: the type of test statistic used to detect DIF items. Possible values are "LRT" (default) and "Wald". See Details.


This command computes the generalized logistic regression statistic (Magis, Raiche, Beland and Gerard, 2011) in the specific framework of differential item functioning among (J+1) groups and J is the number of focal groups. It forms the basic command of difGenLogistic and is specifically designed for this call.

The three possible models to be fitted are:

M_0: logit (π_i) = α + β X + γ_i + δ_i X

M_1: logit (π_i) = α + β X + γ_i

M_2: logit (π_i) = α + β X

where π_i is the probability of answering correctly the item in group i (i = 0, ..., J) and X is the matching criterion. Parameters α and β are the common intercept and the slope of the logistic curves, while γ_i and δ_i are group-specific parameters. For identification reasons the parameters γ_0 and δ_0 of the reference group are set to zero. The set of parameters \{γ_i: i = 1, ..., J\} of the focal groups (g=i) represents the uniform DIF effect across all groups, and the set of parameters \{δ_i: i = 1, ..., n\} is used to model nonuniform DIF effect across all groups. The models are fitted with the glm function.

The matching criterion can be either the test score or any other continuous or discrete variable to be passed in the Logistik function. This is specified by the match argument. By default, it takes the value "score" and the test score (i.e. raw score) is computed. The second option is to assign to match a vector of continuous or discrete numeric values, which acts as the matching criterion. Note that for consistency this vector should not belong to the data matrix.

Two tests are available: the Wald test and the likelihood ratio test. With the likelihood ratio test, two nested models are fitted and compared by means of Wilks' Lambda (or likelihood ratio) statistic (Wilks, 1938). With the Wald test, the model parameters are statistically tested using an appropriate contrast matrix. Each test is set with the criterion argument, with the values "LRT" and "Wald" respectively.

The argument type determines the type of DIF effect to be tested. The three possible values of type are: type="both" which tests the hypothesis H_0: γ_i = δ_i=0 for all i; type="nudif" which tests the hypothesis H_0: δ_i = 0 for all i; and type="udif" which tests the hypothesis H_0: γ_i = 0 | δ_i = 0 for all i. In other words, type="both" tests for DIF (without distinction between uniform and nonuniform effects), while type="udif" and type="nudif" test for uniform and nonuniform DIF, respectively. Whatever the tested DIF effects, this is a simultaneous test of the equality of focal group parameters to zero.

The data are passed through the data argument, with one row per subject and one column per item. Missing values are allowed but must be coded as NA values. They are discarded from the fitting of the logistic models (see glm for further details).

The vector of group membership, specified with member argument, must hold only zeros and positive integers. The value zero corresponds to the reference group, and each positive integer value corresponds to one focal group. At least two different positive integers must be supplied.

Option anchor sets the items which are considered as anchor items for computing the logistic regression DIF statistics. Items other than the anchor items and the tested item are discarded. anchor must hold integer values specifying the column numbers of the corresponding anchor items. It is mainly designed to perform item purification.

In addition to the results of the fitted models (model parameters, covariance matrices, test statistics), Nagelkerke's R^2 coefficients (Nagelkerke, 1991) are computed for each model and the output returns the differences in these coefficients. Such differences are used as measures of effect size by the difGenLogistic command; see Gomez-Benito, Dolores Hidalgo and Padilla (2009), Jodoin and Gierl (2001) and Zumbo and Thomas (1997).


A list with nine components:


the values of the generalized logistic regression DIF statistics (that is, the likelihood ratio test statistics).


the values of Nagelkerke's R^2 coefficients for the "full" model.


the values of Nagelkerke's R^2 coefficients for the "simpler" model.


the differences between Nagelkerke's R^2 coefficients of the tested models. See Details.


a matrix with one row per item and 2+J*2 columns (where J is the number of focal groups), holding successively the fitted parameters \hat{α}, \hat{β}, \hat{γ}_i and \hat{δ}_i (i = 1, ..., J) of the "full" model (M_0 if type="both" or type="nudif", M_1 if type="udif").


the same matrix as parM0 but with fitted parameters for the "simpler" model (M_1 if type="nudif", M_2 if type="both" or type="udif").


a 3-dimensional matrix of size p x p x K, where p is the number of estimated parameters and K is the number of items, holding the p x p covariance matrices of the estimated parameters (one matrix for each tested item).


the value of the criterion argument.


a character string, either "score" or "matching variable" depending on the match 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,


Gomez-Benito, J., Dolores Hidalgo, M. and Padilla, J.-L. (2009). Efficacy of effect size measures in logistic regression: an application for detecting DIF. Methodology, 5, 18-25. doi: 10.1027/1614-2241.5.1.18

Jodoin, M. G. and Gierl, M. J. (2001). Evaluating Type I error and power rates using an effect size measure with logistic regression procedure for DIF detection. Applied Measurement in Education, 14, 329-349. doi: 10.1207/S15324818AME1404_2

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

Nagelkerke, N. J. D. (1991). A note on a general definition of the coefficient of determination. Biometrika, 78, 691-692. doi: 10.1093/biomet/78.3.691

Wilks, S. S. (1938). The large-sample distribution of the likelihood ratio for testing composite hypotheses. Annals of Mathematical Statistics, 9, 60-62. doi: 10.1214/aoms/1177732360

Zumbo, B. D. and Thomas, D. R. (1997). A measure of effect size for a model-based approach for studying DIF. Prince George, Canada: University of Northern British Columbia, Edgeworth Laboratory for Quantitative Behavioral Science.

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(0,nrow(verbal))
 group[Anger>20 & Gender==0] <- 1
 group[Anger<=20 & Gender==1] <- 2
 group[Anger>20 & Gender==1] <- 3

 # Testing both types of DIF simultaneously
 # With all items
 genLogistik(verbal[,1:24], group)
 genLogistik(verbal[,1:24], group, criterion = "Wald")

 # Removing item 6 from the set of anchor items
 genLogistik(verbal[,1:24], group, anchor = c(1:5, 7:24))
 genLogistik(verbal[,1:24], group, anchor = c(1:5, 7:24), criterion = "Wald")

 # Testing nonuniform DIF effect
 genLogistik(verbal[,1:24], group, type = "nudif")
 genLogistik(verbal[,1:24], group, type = "nudif", criterion="Wald")

 # Testing uniform DIF effect
 genLogistik(verbal[,1:24], group, type = "udif")
 genLogistik(verbal[,1:24], group, type = "udif", criterion="Wald")

 # Using trait anger score as matching criterion
 genLogistik(verbal[,1:24], group, match = verbal[,25])
## End(Not run)

[Package difR version 5.1 Index]