### Troubleshooting

## Problem

I'm running logistic regression models to test for differential item functioning (DIF) using IBM SPSS Statistics. I know how to manually construct the likelihood-ratio (LR) chi-square tests for uniform, non-uniform and any DIF, but this is a lot of work. Is there a way to automate this process of running the three models and comparing -2 log-likelihood (LL) values?

## Resolving The Problem

Below is an IBM SPSS Statistics macro, DIFLRT, that automates computation of likelihood-ratio tests for differential item functioning. Follow these steps to run the macro:

1) In the IBM SPSS Statistics menus, select File>New>Syntax.

2) Copy and paste the commands below into the syntax window. (Save it for later use).

3) In the macro call on the last line, replace "item" with the name of your item variable, replace "group" with the name of your grouping variable and replace "scale" with the name of your variable containing the total scale score or other estimate of ability or level of the trait of interest.

4) Specify Run>All.

The macro uses the PLUM procedure, which is in the Base system, so no add-on modules are required. The item analyzed can be binary or ordinal. If you prefer a different type of model, such as a probit regression rather than a logistic regression, you can change the word "LOGIT" in the three PLUM commands to the desired valid link function available in PLUM. The macro suppresses the output from the PLUM procedure. If you want to see these results, insert an asterisk in first column of line 11, the second OMS command.

DEFINE DIFLRT (!POSITIONAL !TOKENS(1)

/!POSITIONAL !TOKENS(1)

/!POSITIONAL !TOKENS(1)).

DATASET NAME original.

DATASET DECLARE temp.

OMS

/SELECT TABLES

/IF COMMANDS=['PLUM'] SUBTYPES=['Model Fitting Information']

/DESTINATION FORMAT=SAV NUMBERED=TableNumber_

OUTFILE='temp'.

OMS

/SELECT ALL

/IF COMMANDS=['PLUM']

/DESTINATION VIEWER=NO.

PLUM !1 BY !2 WITH !3

/LINK=LOGIT

/LOCATION=!3

/PRINT=FIT PARAMETER SUMMARY.

PLUM !1 BY !2 WITH !3

/LINK=LOGIT

/LOCATION=!3 !2

/PRINT=FIT PARAMETER SUMMARY.

PLUM !1 BY !2 WITH !3

/LINK=LOGIT

/LOCATION=!3 !2 !2*!3

/PRINT=FIT PARAMETER SUMMARY.

OMSEND.

DATASET ACTIVATE temp.

SELECT IF Var1='Final'.

COMPUTE LRT=ChiSquare-LAG(ChiSquare).

COMPUTE dof=df-LAG(df).

AGGREGATE

/OUTFILE=* MODE=ADDVARIABLES

/LRT_sum=SUM(LRT)

/dof_sum=SUM(dof).

COMPUTE ChiSquare=MIN(LRT,LRT_sum).

COMPUTE df=MIN(dof,dof_sum).

COMPUTE Sig=SIG.CHISQ(ChiSquare,df).

IF $CASENUM=1 Label_='Omnibus Test for Any DIF'.

IF $CASENUM=2 Label_='Test for Uniform DIF'.

IF $CASENUM=3 Label_='Test for Non-Uniform DIF'.

VARIABLE LABELS Label_ 'Effect'.

OMS

/SELECT TABLES TEXTS HEADINGS

/IF COMMANDS=['Summarize'] SUBTYPES=['Case Processing Summary']

/DESTINATION VIEWER=NO.

SUMMARIZE

/TABLES=Label_ ChiSquare df Sig

/FORMAT=LIST NOCASENUM NOTOTAL

/TITLE='Likelihood-Ratio Tests for Differential Item Functioning'

/MISSING=VARIABLE

/CELLS=NONE.

OMSEND.

DATASET ACTIVATE original WINDOW=ASIS.

DATASET CLOSE temp.

!ENDDEFINE.

DIFLRT item group scale.

### Document Information

**Modified date:**

16 June 2018

## UID

swg21572191