Main Function
To test whether DIF is present, the function dif_analysis() can be
used. It can perform DIF analyses for multiple DIF variables
simultaneously (defined in the argument dif_vars). In this case, the
argument select can either contain a vector specifying a separate
select variable for each DIF variable (see example), or—if the item set
does not vary across DIF variables—a single string can be used as usual
(e.g., select = "mixed"). The required items may vary when only
specific items are considered for a given DIF variable (e.g., only
common items across test booklets for the DIF variable difficulty).
The function tests whether item difficulties differ significantly
between DIF groups and also performs a model comparison between the DIF
model and the main-effect model using AIC and BIC. The results are
automatically saved in RDS format and as Excel tables. In particular,
the function produces a table that can be directly used for the
Technical Report (TR). This table reports unstandardized (before
parentheses) and standardized (in parentheses) DIF effects for each
item. If the file names need to be modified (e.g., because a test is
scaled simultaneously for several cohorts), use the function argument
name_group that adds a suffix to each file name (e.g., "cohort_6").
A summary of the results is also printed to the console.
Example code:
# For Rasch
NEPSroutines::dif_analysis(
resp = resp,
vars = vars,
select = c("dich_common", "dich", "dich"),
valid = "valid",
dif_vars = c("difficulty", "sex", "migration"),
overwrite = TRUE,
print = TRUE,
save = TRUE,
return = FALSE,
path_table = "tables",
path_results = "results"
)
# For PCM
NEPSroutines::dif_analysis(
resp = resp,
vars = vars,
select = c("mixed_common", "mixed", "mixed"),
valid = "valid",
dif_vars = c("difficulty", "sex", "migration"),
scoring = "scoring",
overwrite = TRUE,
print = TRUE,
save = TRUE,
return = FALSE,
path_table = "tables",
path_results = "results",
suf_item_names = TRUE
)Information on the individual function arguments can be obtained via the
help function (?dif_analysis).