checkContextVars: check for consistency of context variables and items

View source: R/checkModels.R

checkContextVarsR Documentation

check for consistency of context variables and items

Description

Function checks whether some types of context vars, i.e. group, DIF and weighting variables, are consistent with item variables. The function is mainly used for internal consistency checks.

Usage

checkContextVars (x, varname, type = c("weight", "DIF", "group", "HG"), itemdata,
                  suppressAbort = FALSE, internal = FALSE)

Arguments

x

A vector with values of the context variable (e.g., DIF variable)

varname

Optional: name of the context variable

type

Type of the context variable with following entries allowed: DIF, group, HG, or weight.

itemdata

data.frame with item responses

suppressAbort

Logical: should the function suppress abort if inconsistencies occur?

internal

Logical: is only used for internal use. Recommend to set to FALSE.

Value

A list

Examples

data(trends)
# first reshape the data for the first time of measurement set into wide format
datW <- reshape2::dcast(trends[which(trends[,"year"] == 2010),],
                        idstud+sex+ses+language~item, value.var="value")
chk1 <- checkContextVars(datW[,"language"], "language", type="DIF",
                         itemdata = datW[,-c(1:4)])
chk1$info

weirichs/eatModel documentation built on Jan. 26, 2025, 4:01 p.m.