Title: | Regularized Differential Item Functioning |
Version: | 1.1.1 |
Author: | William Belzak |
Maintainer: | William Belzak <wbelzak@gmail.com> |
Description: | Performs regularization of differential item functioning (DIF) parameters in item response theory (IRT) models (Belzak & Bauer, 2020) https://pubmed.ncbi.nlm.nih.gov/31916799/ using a penalized expectation-maximization algorithm. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.1 |
VignetteBuilder: | knitr |
Imports: | stats (> 3.0.0), utils, statmod, parallel, foreach |
Suggests: | knitr, testthat (≥ 2.1.0), covr, rmarkdown |
NeedsCompilation: | no |
Packaged: | 2024-02-23 00:10:48 UTC; wbelz |
Repository: | CRAN |
Date/Publication: | 2024-02-23 00:30:02 UTC |
Regularized differential item functioning for IRT and CFA models.
Description
Regularized Differential Item Functioning
Details
regDIF is a package that performs regularization of differential item functioning (DIF) in item response theory (IRT) and confirmatory factor analysis (CFA) models using a penalized expectation-maximization algorithm.
Author(s)
William Belzak wbelzak@gmail.com
Expectation step.
Description
Expectation step.
Usage
Estep(
p,
item_data,
pred_data,
item_type,
mean_predictors,
var_predictors,
theta,
samp_size,
num_items,
num_responses,
adapt_quad,
num_quad,
get_eap,
NA_cases
)
Arguments
p |
List of parameters. |
item_data |
Matrix or dataframe of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_type |
Vector of character values indicating the item type. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
theta |
Vector of fixed quadrature points. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_responses |
Number of responses for each item. |
adapt_quad |
Logical indicating whether to use adaptive quadrature. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
get_eap |
Logical indicating whether to compute EAP scores. |
NA_cases |
Logical vector indicating missing observations. |
Value
a "list"
of posterior values from the expectation step
Expectation step with proxy data.
Description
Expectation step with proxy data.
Usage
Estep_proxy(
p,
item_data,
pred_data,
item_type,
mean_predictors,
var_predictors,
prox_data,
samp_size,
num_items,
num_responses,
get_eap,
NA_cases
)
Arguments
p |
List of parameters. |
item_data |
Matrix or dataframe of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_type |
Vector of character values indicating the item type. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
prox_data |
Vector of observed proxy scores. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_responses |
Number of responses for each item. |
get_eap |
Logical indicating whether to compute EAP scores. |
NA_cases |
Logical vector indicating missing observations. |
Value
a "list"
of posterior values from the expectation step
Maximization step.
Description
Maximization step.
Usage
Mstep(
p,
item_data,
pred_data,
prox_data,
mean_predictors,
var_predictors,
eout,
item_type,
pen_type,
tau_current,
pen,
pen.deriv,
alpha,
gamma,
anchor,
final_control,
samp_size,
num_responses,
num_items,
num_quad,
num_predictors,
num_tau,
max_tau,
method
)
Arguments
p |
List of parameters. |
item_data |
Matrix or data frame of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
prox_data |
Vector of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
eout |
E-step output, including matrix for item and impact equations, in addition to theta values (possibly adaptive). |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
pen_type |
Character value indicating the penalty function to use. |
tau_current |
A single numeric value of tau that exists within
|
pen |
Current penalty index. |
pen.deriv |
Logical value indicating whether to use the second derivative of the penalized parameter during regularization. The default is TRUE. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
final_control |
Control parameters. |
samp_size |
Sample size in data set. |
num_responses |
Number of responses for each item. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors. |
num_tau |
Logical indicating whether the minimum tau value needs to be identified during the regDIF procedure. |
max_tau |
Logical indicating whether to output the minimum tau value needed to remove all DIF from the model. |
method |
Character value indicating the type of optimization method. Options include "MNR", "UNR", and "CD" |
Value
a "list"
of estimates obtained from the maximization step using multivariate
Newton-Raphson
Maximization step using latent variable and item response blocks.
Description
Maximization step using latent variable and item response blocks.
Usage
Mstep_block(
p,
item_data,
pred_data,
prox_data,
mean_predictors,
var_predictors,
eout,
item_type,
pen_type,
tau_current,
pen,
alpha,
gamma,
anchor,
final_control,
samp_size,
num_responses,
num_items,
num_quad,
num_predictors,
num_tau,
max_tau
)
Arguments
p |
List of parameters. |
item_data |
Matrix or data frame of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
prox_data |
Vector of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
eout |
E-step output, including matrix for item and impact equations, in addition to theta values (possibly adaptive). |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
pen_type |
Character value indicating the penalty function to use. |
tau_current |
A single numeric value of tau that exists within
|
pen |
Current penalty index. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
final_control |
Control parameters. |
samp_size |
Sample size in data set. |
num_responses |
Number of responses for each item. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors. |
num_tau |
Logical indicating whether the minimum tau value needs to be identified during the regDIF procedure. |
max_tau |
Logical indicating whether to output the minimum tau value needed to remove all DIF from the model. |
Value
a "list"
of estimates obtained from the maximization step using multivariate
Newton-Raphson
Maximization step using coordinate descent optimization.
Description
Maximization step using coordinate descent optimization.
Usage
Mstep_cd(
p,
item_data,
pred_data,
mean_predictors,
var_predictors,
eout,
item_type,
pen_type,
tau_current,
pen,
alpha,
gamma,
anchor,
final_control,
samp_size,
num_responses,
num_items,
num_quad,
num_predictors,
num_tau,
max_tau
)
Arguments
p |
List of parameters. |
item_data |
Matrix or data frame of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
eout |
E step output, including matrix for item and impact equations, in addition to theta values (possibly adaptive). |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
pen_type |
Character value indicating the penalty function to use. |
tau_current |
A single numeric value of tau that exists within
|
pen |
Current penalty index. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
final_control |
Control parameters. |
samp_size |
Sample size in data set. |
num_responses |
Number of responses for each item. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors. |
num_tau |
Logical indicating whether the minimum tau value needs to be identified during the regDIF procedure. |
max_tau |
Logical indicating whether to output the maximum tau value needed to remove all DIF from the model. |
Value
a "list"
of estimates obtained from the maximization step using univariate
Newton-Raphson (i.e., one step of coordinate descent)
Maximization step using coordinate descent optimization.
Description
Maximization step using coordinate descent optimization.
Usage
Mstep_cd2(
p,
item_data,
pred_data,
mean_predictors,
var_predictors,
eout,
item_type,
pen_type,
tau_current,
pen,
alpha,
gamma,
anchor,
final_control,
samp_size,
num_responses,
num_items,
num_quad,
num_predictors,
num_tau,
max_tau
)
Arguments
p |
List of parameters. |
item_data |
Matrix or data frame of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
eout |
E step output, including matrix for item and impact equations, in addition to theta values (possibly adaptive). |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
pen_type |
Character value indicating the penalty function to use. |
tau_current |
A single numeric value of tau that exists within
|
pen |
Current penalty index. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
final_control |
Control parameters. |
samp_size |
Sample size in data set. |
num_responses |
Number of responses for each item. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors. |
num_tau |
Logical indicating whether the minimum tau value needs to be identified during the regDIF procedure. |
max_tau |
Logical indicating whether to output the maximum tau value needed to remove all DIF from the model. |
Value
a "list"
of estimates obtained from the maximization step using coordinate
descent
Maximization step.
Description
Maximization step.
Usage
Mstep_simple(
p,
item_data,
pred_data,
prox_data,
mean_predictors,
var_predictors,
eout,
item_type,
pen_type,
tau_current,
pen,
pen.deriv,
alpha,
gamma,
anchor,
final_control,
samp_size,
num_responses,
num_items,
num_quad,
num_predictors,
num_tau,
max_tau,
optim_method
)
Arguments
p |
List of parameters. |
item_data |
Matrix or data frame of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
prox_data |
Vector of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
eout |
E-step output, including matrix for item and impact equations, in addition to theta values (possibly adaptive). |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
pen_type |
Character value indicating the penalty function to use. |
tau_current |
A single numeric value of tau that exists within
|
pen |
Current penalty index. |
pen.deriv |
Logical value indicating whether to use the second derivative of the penalized parameter during regularization. The default is TRUE. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
final_control |
Control parameters. |
samp_size |
Sample size in data set. |
num_responses |
Number of responses for each item. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors. |
num_tau |
Logical indicating whether the minimum tau value needs to be identified during the regDIF procedure. |
max_tau |
Logical indicating whether to output the minimum tau value needed to remove all DIF from the model. |
optim_method |
Character value of the type of estimation method to use |
Value
a "list"
of estimates obtained from the maximization step using univariate
Newton-Raphson
Binary item tracelines.
Description
Binary item tracelines.
Usage
bernoulli_traceline_pts(p_item, theta, pred_data, samp_size)
Arguments
p_item |
Vector of item parameters. |
theta |
Vector of theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
samp_size |
Sample size in dataset. |
Value
a "matrix"
of probability values for Bernoulli item likelihood
Binary item tracelines.
Description
Binary item tracelines.
Usage
bernoulli_traceline_pts2(p_item, theta, pred_data, samp_size)
Arguments
p_item |
Vector of item parameters. |
theta |
Vector of theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
samp_size |
Sample size in dataset. |
Value
a "matrix"
of probability values for Bernoulli item likelihood
Binary item tracelines for proxy scores.
Description
Binary item tracelines for proxy scores.
Usage
bernoulli_traceline_pts_proxy(p_item, prox_data, pred_data)
Arguments
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
Value
a "matrix"
of probability values for Bernoulli item likelihood using observed
proxy scores
Coefficient function for regDIF function
Description
Coefficient function for regDIF function
Usage
## S3 method for class 'regDIF'
coef(object, tau = NULL, method = "bic", ...)
Arguments
object |
Fitted regDIF model object. |
tau |
Optional character or numeric indicating the tau(s) at
which the model coefficients are returned. For character value, may be
|
method |
Character value indicating the model fit statistic to be used
for determining |
... |
Additional arguments to be passed through to |
Value
NULL
Ordinal tracelines.
Description
Ordinal tracelines.
Usage
cumulative_traceline_pts(
p_item,
theta,
pred_data,
samp_size,
num_responses_item,
num_quad
)
Arguments
p_item |
Vector of item parameters. |
theta |
Vector of theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
samp_size |
Sample size in dataset. |
num_responses_item |
Number of responses for item. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "matrix"
of probability values for categorical (cumulative) item likelihood
Ordinal tracelines using proxy data.
Description
Ordinal tracelines using proxy data.
Usage
cumulative_traceline_pts_proxy(
p_item,
prox_data,
pred_data,
samp_size,
num_responses_item
)
Arguments
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
samp_size |
Sample size in dataset. |
num_responses_item |
Number of responses for item. |
Value
a "matrix"
of probability values for categorical (cumulative) item likelihood
Partial derivatives for mean impact equation.
Description
Partial derivatives for mean impact equation.
Usage
d_alpha(
p_impact,
etable,
theta,
mean_predictors,
var_predictors,
cov,
samp_size,
num_items,
num_quad
)
Arguments
p_impact |
Vector of impact parameters. |
etable |
E-table for impact. |
theta |
Matrix of adaptive theta values. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
cov |
Covariate being maximized. |
samp_size |
Sample size in data set. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for mean impact equation (to
use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for mean impact equation using proxy data.
Description
Partial derivatives for mean impact equation using proxy data.
Usage
d_alpha_proxy(
p_impact,
prox_data,
mean_predictors,
var_predictors,
cov,
samp_size,
num_items
)
Arguments
p_impact |
Vector of impact parameters. |
prox_data |
Matrix of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
cov |
Covariate being maximized. |
samp_size |
Sample size in data set. |
num_items |
Number of items in data set. |
Value
a "list"
of first and second partial derivatives for mean impact equation (to
use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for binary items.
Description
Partial derivatives for binary items.
Usage
d_bernoulli(
parm,
p_item,
etable_item,
theta,
pred_data,
cov,
samp_size,
num_items,
num_quad
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
etable_item |
E-table for item. |
theta |
Matrix of adaptive theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for Bernoulli item likelihood (to
use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for binary items by item-blocks.
Description
Partial derivatives for binary items by item-blocks.
Usage
d_bernoulli_itemblock(
p_item,
etable,
theta,
pred_data,
item_data_current,
samp_size,
num_items,
num_predictors,
num_quad
)
Arguments
p_item |
Vector of item parameters. |
etable |
E-table for item. |
theta |
Matrix of adaptive theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_data_current |
Vector of current item responses. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_predictors |
Number of predictors in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for Bernoulli item likelihood (to
use with multivariate Newton-Raphson)
Partial derivatives for binary items by item-blocks using observed score proxy.
Description
Partial derivatives for binary items by item-blocks using observed score proxy.
Usage
d_bernoulli_itemblock_proxy(
p_item,
pred_data,
item_data_current,
prox_data,
samp_size,
num_items,
num_predictors,
num_quad
)
Arguments
p_item |
Vector of item parameters. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_data_current |
Vector of current item responses. |
prox_data |
Vector of observed proxy scores. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_predictors |
Number of predictors in dataset. |
Value
a "list"
of first and second partial derivatives for Bernoulli item likelihood (to
use with multivariate Newton-Raphson and observed proxy scores)
Partial derivatives for binary items with proxy data.
Description
Partial derivatives for binary items with proxy data.
Usage
d_bernoulli_proxy(
parm,
p_item,
prox_data,
pred_data,
item_data_current,
cov,
samp_size,
num_items
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_data_current |
Vector of current item responses. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
Value
a "list"
of first and second partial derivatives for Bernoulli item likelihood (to
use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for ordinal items.
Description
Partial derivatives for ordinal items.
Usage
d_categorical(
parm,
p_item,
etable_item,
theta,
pred_data,
thr,
cov,
samp_size,
num_responses_item,
num_items,
num_quad
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
etable_item |
E-table for impact. |
theta |
Matrix of adaptive theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
thr |
Threshold value being maximized. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_responses_item |
Number of responses for item. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for categorical item likelihood
(to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for ordinal items.
Description
Partial derivatives for ordinal items.
Usage
d_categorical_itemblock(
parm,
p_item,
etable,
theta,
pred_data,
item_data_current,
samp_size,
num_responses_item,
num_items,
num_predictors,
num_quad
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
etable |
E-table for impact. |
theta |
Matrix of adaptive theta values. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_data_current |
Vector of current item responses. |
samp_size |
Sample size in dataset. |
num_responses_item |
Number of responses for item. |
num_items |
Number of items in dataset. |
num_predictors |
Number of predictors in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for categorical item likelihood
(to use with multivariate Newton-Raphson)
Partial derivatives for ordinal items using proxy data.
Description
Partial derivatives for ordinal items using proxy data.
Usage
d_categorical_proxy(
parm,
p_item,
prox_data,
pred_data,
item_data_current,
thr,
cov,
samp_size,
num_responses_item,
num_items
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
item_data_current |
Vector of current item responses. |
thr |
Threshold value being maximized. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_responses_item |
Number of responses for item. |
num_items |
Number of items in dataset. |
Value
a "list"
of first and second partial derivatives for categorical item likelihood
(to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for continuous items.
Description
Partial derivatives for continuous items.
Usage
d_gaussian_itemblock(
p_item,
etable,
theta,
responses_item,
pred_data,
samp_size,
num_items,
num_quad,
num_predictors
)
Arguments
p_item |
Vector of item parameters. |
etable |
E-table. |
theta |
Matrix of adaptive theta values. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors in dataset. |
Value
a "list"
of first and second partial derivatives for mean value of Gaussian item
likelihood (to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for continuous items using proxy data.
Description
Partial derivatives for continuous items using proxy data.
Usage
d_gaussian_itemblock_proxy(
p_item,
prox_data,
responses_item,
pred_data,
samp_size,
num_items,
num_quad,
num_predictors
)
Arguments
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors in dataset. |
Value
a "list"
of first and second partial derivatives for mean value of Gaussian item
likelihood (to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for mean and variance impact equation.
Description
Partial derivatives for mean and variance impact equation.
Usage
d_impact_block(
p_mean,
p_var,
etable,
theta,
mean_predictors,
var_predictors,
samp_size,
num_items,
num_quad,
num_predictors
)
Arguments
p_mean |
Vector of mean impact parameters. |
p_var |
Vector of variance impact parameters. |
etable |
E-table for impact. |
theta |
Matrix of adaptive theta values. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
samp_size |
Sample size in data set. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
num_predictors |
Number of predictors in dataset. |
Value
a "list"
of first and second partial derivatives for impact equation (to use
with multivariate Newton-Raphson)
Partial derivatives for mean and variance impact equation using observed score proxy.
Description
Partial derivatives for mean and variance impact equation using observed score proxy.
Usage
d_impact_block_proxy(
p_mean,
p_var,
prox_data,
mean_predictors,
var_predictors,
samp_size,
num_items,
num_quad,
num_predictors
)
Arguments
p_mean |
Vector of mean impact parameters. |
p_var |
Vector of variance impact parameters. |
prox_data |
Vector of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
samp_size |
Sample size in data set. |
num_items |
Number of items in data set. |
num_predictors |
Number of predictors in dataset. |
Value
a "list"
of first and second partial derivatives for impact equation (to
use with multivariate Newton-Rapshon and observed proxy scores)
Partial derivatives for mean parameter of continuous items.
Description
Partial derivatives for mean parameter of continuous items.
Usage
d_mu_gaussian(
parm,
p_item,
etable,
theta,
responses_item,
pred_data,
cov,
samp_size,
num_items,
num_quad
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
etable |
E-table. |
theta |
Matrix of adaptive theta values. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for mean value of Gaussian item
likelihood (to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for mean parameter of continuous items with proxy data.
Description
Partial derivatives for mean parameter of continuous items with proxy data.
Usage
d_mu_gaussian_proxy(
parm,
p_item,
prox_data,
responses_item,
pred_data,
cov,
samp_size
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
Value
a "list"
of first and second partial derivatives for mean value of Gaussian item
likelihood (to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for mean impact equation.
Description
Partial derivatives for mean impact equation.
Usage
d_phi(
p_impact,
etable,
theta,
mean_predictors,
var_predictors,
cov,
samp_size,
num_items,
num_quad
)
Arguments
p_impact |
Vector of impact parameters. |
etable |
E-table for impact. |
theta |
Matrix of adaptive theta values. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for variance impact equation (to
use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for mean impact equation using proxy data.
Description
Partial derivatives for mean impact equation using proxy data.
Usage
d_phi_proxy(
p_impact,
prox_data,
mean_predictors,
var_predictors,
cov,
samp_size,
num_items
)
Arguments
p_impact |
Vector of impact parameters. |
prox_data |
Matrix of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
Value
a "list"
of first and second partial derivatives for variance impact equation (to
use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for variance parameter of continuous items.
Description
Partial derivatives for variance parameter of continuous items.
Usage
d_sigma_gaussian(
parm,
p_item,
etable,
theta,
responses_item,
pred_data,
cov,
samp_size,
num_items,
num_quad
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
etable |
E-table for impact. |
theta |
Matrix of adaptive theta values. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of first and second partial derivatives for variance value of Gaussian
item likelihood (to use with coordinate descent and univariate Newton-Raphson)
Partial derivatives for variance parameter of continuous items with proxy data.
Description
Partial derivatives for variance parameter of continuous items with proxy data.
Usage
d_sigma_gaussian_proxy(
parm,
p_item,
prox_data,
responses_item,
pred_data,
cov,
samp_size,
num_items
)
Arguments
parm |
Item parameter being maximized. |
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or dataframe of DIF and/or impact predictors. |
cov |
Covariate being maximized. |
samp_size |
Sample size in dataset. |
num_items |
Number of items in dataset. |
Value
a "list"
of first and second partial derivatives for variance value of Gaussian
item likelihood (to use with coordinate descent and univariate Newton-Raphson)
Penalized expectation-maximization algorithm.
Description
Penalized expectation-maximization algorithm.
Usage
em_estimation(
p,
item_data,
pred_data,
prox_data,
mean_predictors,
var_predictors,
item_type,
theta,
pen_type,
tau_vec,
id_tau,
num_tau,
alpha,
gamma,
pen,
pen.deriv,
anchor,
final_control,
samp_size,
num_items,
num_responses,
num_predictors,
num_quad,
adapt_quad,
optim_method,
estimator_history,
estimator_limit,
NA_cases,
exit_code
)
Arguments
p |
List of parameters with starting values obtained from preprocess. |
item_data |
Matrix or data frame of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
prox_data |
Vector of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
item_type |
Character value or vector indicating the type of item to be modeled. |
theta |
Vector of fixed quadrature points. |
pen_type |
Character value indicating the penalty function to use. |
tau_vec |
Vector of tau values that either are automatically generated
or provided by the user. The first |
id_tau |
Logical indicating whether to identify the minimum value of tau in which all DIF parameters are removed from the model. |
num_tau |
Numeric value indicating the number of tau values to run regDIF on. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
pen |
Index for the tau vector. |
pen.deriv |
Logical value indicating whether to use the second derivative of the penalized parameter during regularization. The default is TRUE. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
final_control |
Control parameters. |
samp_size |
Numeric value indicating the sample size. |
num_items |
Numeric value indicating the number of items. |
num_responses |
Vector with number of responses for each item. |
num_predictors |
Numeric value indicating the number of predictors. |
num_quad |
Numeric value indicating the number of quadrature points. |
adapt_quad |
Logical value indicating whether to use adaptive quad. needs to be identified. |
optim_method |
Character value indicating the type of optimization method to use. |
estimator_history |
List to save EM iterations for supplemental EM algorithm. |
estimator_limit |
Logical value indicating whether the EM algorithm reached the maxit limit in the previous estimation round. |
NA_cases |
Logical vector indicating if observation is missing. |
exit_code |
Integer indicating if the model has converged properly. |
Value
a "list"
of matrices with unprocessed model estimates
Continuous tracelines.
Description
Continuous tracelines.
Usage
gaussian_traceline_pts(p_item, theta, responses_item, pred_data, samp_size)
Arguments
p_item |
Vector of item parameters. |
theta |
Vector of theta values. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
samp_size |
Sample size in data set. |
Value
a "matrix"
of probability values for Gaussian item likelihood
Continuous tracelines using proxy data.
Description
Continuous tracelines using proxy data.
Usage
gaussian_traceline_pts_proxy(
p_item,
prox_data,
responses_item,
pred_data,
samp_size
)
Arguments
p_item |
Vector of item parameters. |
prox_data |
Vector of observed proxy scores. |
responses_item |
Vector of item responses. |
pred_data |
Matrix or data frame of DIF and/or impact predictors. |
samp_size |
Sample size in data set. |
Value
a "matrix"
of probability values for Gaussian item likelihood
Simulated data example with multiple DIF covariates
Description
A simulated dataset containing six binary items and three DIF covariates
Usage
ida
Format
A data frame with 500 rows and 9 variables:
- item1
- item2
- item3
- item4
- item5
- item6
- age
- gender
- study
...
Maximization step.
Description
Maximization step.
Usage
information_criteria(
eout,
p,
item_data,
pred_data,
prox_data,
mean_predictors,
var_predictors,
item_type,
gamma,
samp_size,
num_responses,
num_items,
num_quad
)
Arguments
eout |
E-table output. |
p |
List of parameters. |
item_data |
Matrix or data.frame of item responses. |
pred_data |
Matrix or data.frame of DIF and/or impact predictors. |
prox_data |
Vector of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. |
samp_size |
Sample size in data set. |
num_responses |
Number of responses for each item. |
num_items |
Number of items in data set. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
Value
a "list"
of information criteria to use for model selection
Plot function for regDIF function
Description
Plot function for regDIF function
Usage
## S3 method for class 'regDIF'
plot(x, y = NULL, method = "bic", color.seed = 123, legend.plot = TRUE, ...)
Arguments
x |
Fitted regDIF model object. |
y |
Unused for plotting regDIF model object. |
method |
Fit statistic to use for identifying DIF effects in plot. |
color.seed |
Random seed to sample line colors and line types for DIF effects in plot. |
legend.plot |
Logical indicating whether to plot a legend. Default is |
... |
Additional arguments to be passed through to |
Value
a "plot"
object for a "regDIF"
fit
Maximization step.
Description
Maximization step.
Usage
postprocess(
estimates,
item.data,
pred.data,
prox.data,
item_data,
pred_data,
prox_data,
mean_predictors,
var_predictors,
item_type,
tau_vec,
num_tau,
alpha,
pen,
anchor,
control,
final_control,
final,
samp_size,
num_responses,
num_predictors,
num_items,
num_quad,
NA_cases
)
Arguments
estimates |
List of converged parameters. |
item.data |
User-given matrix or data.frame of DIF and/or impact predictors. |
pred.data |
User-given matrix or data.frame of item responses. |
prox.data |
User-given matrix or data.frame of observed proxy scores. |
item_data |
Processed matrix or data.frame of item responses. |
pred_data |
Processed matrix or data.frame of DIF and/or impact predictors. |
prox_data |
Processed matrix or data.frame of observed proxy scores. |
mean_predictors |
Possibly different matrix of predictors for the mean impact equation. |
var_predictors |
Possibly different matrix of predictors for the variance impact equation. |
item_type |
Optional character value or vector indicating the type of item to be modeled. |
tau_vec |
Optional numeric vector of tau values. |
num_tau |
Logical indicating whether the minimum tau value needs to be identified during the regDIF procedure. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. |
pen |
Tuning parameter index. |
anchor |
Anchor item(s). |
control |
Optional list of user-defined control parameters |
final_control |
List of final control parameters. |
final |
List of model results. |
samp_size |
Sample size in dataset. |
num_responses |
Number of responses for each item. |
num_predictors |
Number of predictors. |
num_items |
Number of items in dataset. |
num_quad |
Number of quadrature points used for approximating the latent variable. |
NA_cases |
Logical vector indicating NA cases. |
Value
a "list"
object of processed "regDIF"
results
Pre-process data.
Description
Pre-process data.
Usage
preprocess(
item.data,
pred.data,
prox.data,
item.type,
pen.type,
tau,
num.tau,
anchor,
stdz,
control,
call
)
Arguments
item.data |
Matrix or data frame of item responses. |
pred.data |
Matrix or data frame of DIF and/or impact predictors. |
prox.data |
Vector of observed proxy scores. |
item.type |
Character value or vector indicating the item response distributions. |
pen.type |
Character indicating type of penalty. |
tau |
Optional numeric vector of tau values. |
num.tau |
Numeric indicating number of tau values to run Reg-DIF on. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
stdz |
Logical value indicating whether to standardize DIF and impact predictors for regularization. |
control |
Optional list of additional model specification and optimization parameters. |
call |
Defined from regDIF. |
Value
a "list"
of default controls for "em_estimation"
Print function for regDIF function
Description
Print function for regDIF function
Usage
## S3 method for class 'regDIF'
print(x, ...)
Arguments
x |
Fitted regDIF model object. |
... |
Additional arguments to be passed through |
Value
NULL
Regularized Differential Item Functioning
Description
Identify DIF in item response theory models using regularization.
Usage
regDIF(item.data,
pred.data,
prox.data = NULL,
item.type = NULL,
pen.type = NULL,
pen.deriv = TRUE,
tau = NULL,
num.tau = 100,
alpha = 1,
gamma = 3,
anchor = NULL,
stdz = TRUE,
control = list())
Arguments
item.data |
Matrix or data frame of item responses. See below for supported item types. |
pred.data |
Matrix or data frame of predictors affecting item responses
(DIF) and latent variable (impact). See |
prox.data |
Optional vector of observed scores to serve as a proxy for the latent variable. If a vector is supplied, a multivariate regression model will be fit to the data. The default is NULL, indicating that latent scores will be estimated during model estimation. |
item.type |
Optional character value or vector indicating the type of item to be modeled. The default is NULL, corresponding to a 2PL or graded item type. Different item types may be specified for a single model by providing a vector equal in length to the number of items in item.data. The options include:
|
pen.type |
Optional character value indicating the penalty function to use. The default is NULL, corresponding to the LASSO function. The options include:
|
pen.deriv |
Logical value indicating whether to use the second derivative of the penalized parameter during regularization. The default is TRUE. |
tau |
Optional numeric vector of tau values |
num.tau |
Numeric value indicating how many tau values to fit. The default is 100. |
alpha |
Numeric value indicating the alpha parameter in the elastic net penalty function. Alpha controls the degree to which LASSO or ridge is used during regularization. The default is 1, which is equivalent to LASSO. NOTE: If using MCP penalty, alpha may not be exactly 0. |
gamma |
Numeric value indicating the gamma parameter in the MCP function. Gamma controls the degree of tapering of DIF effects as tau decreases. Larger gamma leads to faster tapering (less bias but possibly more unstable optimization), whereas smaller gamma leads to slower tapering (more bias but more stable optimization). Default is 3. Must be greater than 1. |
anchor |
Optional numeric value or vector indicating which item
response(s) are anchors (e.g., |
stdz |
Logical value indicating whether to standardize DIF and
impact predictors for regularization. Default is |
control |
Optional list of different model specifications and optimization parameters. May be:
|
Value
Function returns an object of class regDIF
, which is a list of results from
the regularization routine
Examples
library(regDIF)
head(ida)
item.data <- ida[,1:6]
pred.data <- ida[,7:9]
prox.data <- rowSums(item.data)
fit <- regDIF(item.data, pred.data, prox.data, num.tau = 10)
summary(fit)
Standard Errors for regDIF Model(s)
Description
Obtain standard errors for regDIF model(s).
Usage
se.regDIF(fit,
se.type = "sem",
tau = NULL,
...)
Arguments
fit |
A regDIF fitted model object of class |
se.type |
Character value indicating the method of computing standard errors for a regDIF fitted model. Default is "sem", or the supplemental EM algorithm (see Cai, 2008). Other options are in development and not yet supported. |
tau |
Optional numeric or vector of tau values corresponding to those
already fit in |
... |
Additional arguments to pass to regDIF function if different settings are desired. |
Value
Function returns an object of class se.regDIF
Summary function for regDIF function
Description
Summary function for regDIF function
Usage
## S3 method for class 'regDIF'
summary(object, method = "bic", ...)
Arguments
object |
Fitted regDIF model object. |
method |
Fit statistic to use for displaying minimum tau model. |
... |
Additional arguments to be passed through |
Value
NULL