hgrmDIF fits a hierarchical graded response model similar to hgrm(), but person-specific
covariates x are allowed to affect item responses directly (not via the latent preference).
This model can be used to test for the presence of differential item functioning.
hgrmDIF(
y,
x = NULL,
z = NULL,
x0 = x[, -1, drop = FALSE],
items_dif = 1L,
form_dif = c("uniform", "non-uniform"),
constr = c("latent_scale"),
beta_set = 1L,
sign_set = TRUE,
init = c("naive", "glm", "irt"),
control = list()
)An object of class hgrm.
A data frame of parameter estimates, standard errors, z values and p values.
A data frame of EAP estimates of latent preferences and their approximate standard errors.
Variance-covariance matrix of parameter estimates.
The log-likelihood value at convergence.
Number of units.
Number of items.
A vector denoting the number of response categories for each item.
A list showing the levels of the factorized response categories.
The number of predictors for the mean equation.
The number of predictors for the variance equation.
The number of predictors for items with DIF.
Item coefficient estimates.
List of control values.
The matched call.
A data frame or matrix of item responses.
An optional model matrix, including the intercept term, that predicts the mean of the latent preference. If not supplied, only the intercept term is included.
An optional model matrix, including the intercept term, that predicts the variance of the latent preference. If not supplied, only the intercept term is included.
A matrix specifying the covariates by which differential item functioning operates. If not supplied,
x0 is taken to be a matrix containing all predictors in x except the intercept.
The indices of the items for which differential item functioning is tested.
Form of differential item functioning being tested. Either "uniform" or "non-uniform."
The type of constraints used to identify the model: "latent_scale", or "items". The default, "latent_scale" constrains the mean of latent preferences to zero and the geometric mean of prior variance to one; "items" places constraints on item parameters instead and sets the mean of item difficulty parameters to zero and the geometric mean of the discrimination parameters to one. Currently, only "latent_scale" is supported in hgrmDIF().
The index of the item for which the discrimination parameter is
restricted to be positive (or negative). It may take any integer value from
1 to ncol(y).
Logical. Should the discrimination parameter of
the corresponding item (indexed by beta_set) be positive
(if TRUE) or negative (if FALSE)?
A character string indicating how item parameters are initialized. It can be "naive", "glm", or "irt".
A list of control values
The maximum number of iterations of the EM algorithm. The default is 150.
Tolerance parameter used to determine convergence of the
EM algorithm. Specifically, iterations continue until the Euclidean
distance between \(\beta_{n}\) and \(\beta_{n-1}\) falls under eps,
where \(\beta\) is the vector of item discrimination parameters.
eps=1e-3 by default.
The maximum number of iterations of the conditional maximization procedures for updating \(\gamma\) and \(\lambda\). The default is 15.
Tolerance parameter used to determine convergence of the
conditional maximization procedures for updating \(\gamma\) and
\(\lambda\). Specifically, iterations continue until the Euclidean
distance between two consecutive log likelihoods falls under eps2.
eps2=1e-3 by default.
Number of Gauss-Legendre quadrature points for the E-step. The default is 25.
[-C, C] sets the range of integral in the E-step. C=4 by default.
Logical. Should the progress of the EM algorithm be printed
to the console? FALSE by default.
# \donttest{
y <- nes_econ2008[, -(1:3)]
x <- model.matrix( ~ party * educ, nes_econ2008)
nes_m2 <- hgrmDIF(y, x, items_dif = 1:2)
coef_item(nes_m2)
# }
Run the code above in your browser using DataLab