estimNLR {difNLR} | R Documentation |
Non-linear regression DIF models estimation.
Description
Estimates parameters of non-linear regression models for DIF detection using either non-linear least squares or maximum likelihood method with various algorithms.
Usage
estimNLR(y, match, group, formula, method, lower, upper, start)
## S3 method for class 'estimNLR'
logLik(object, ...)
## S3 method for class 'estimNLR'
coef(object, ...)
## S3 method for class 'estimNLR'
fitted(object, ...)
## S3 method for class 'estimNLR'
residuals(object, ...)
## S3 method for class 'estimNLR'
print(x, ...)
## S3 method for class 'estimNLR'
vcov(object, sandwich = FALSE, ...)
Arguments
y |
numeric: a binary vector of responses ( |
match |
numeric: a numeric vector describing the matching criterion. |
group |
numeric: a binary vector of a group membership ( |
formula |
formula: specification of the model. It can be obtained by the
|
method |
character: an estimation method to be applied. The options are
|
lower |
numeric: lower bounds for item parameters of the model specified
in the |
upper |
numeric: upper bounds for item parameters of the model specified
in the |
start |
numeric: initial values of item parameters. They can be obtained
by the |
object |
an object of the |
... |
other generic parameters for S3 methods. |
x |
an object of the |
sandwich |
logical: should the sandwich estimator be applied for
computation of the covariance matrix of item parameters when using
|
Details
The function offers either the non-linear least squares estimation via the
nls
function (Drabinova & Martinkova, 2017; Hladka &
Martinkova, 2020), the maximum likelihood method with the "L-BFGS-B"
algorithm with constraints via the optim
function (Hladka &
Martinkova, 2020), the maximum likelihood method with the EM algorithm (Hladka,
Martinkova, & Brabec, 2024), the maximum likelihood method with the algorithm
based on parametric link function (PLF; Hladka, Martinkova, & Brabec, 2024), or
the maximum likelihood method with the iteratively reweighted least squares
algorithm via the glm
function.
Author(s)
Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
hladka@cs.cas.cz
Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
martinkova@cs.cas.cz
References
Drabinova, A. & Martinkova, P. (2017). Detection of differential item functioning with nonlinear regression: A non-IRT approach accounting for guessing. Journal of Educational Measurement, 54(4), 498–517, doi:10.1111/jedm.12158.
Hladka, A. & Martinkova, P. (2020). difNLR: Generalized logistic regression models for DIF and DDF detection. The R Journal, 12(1), 300–323, doi:10.32614/RJ-2020-014.
Hladka, A. (2021). Statistical models for detection of differential item functioning. Dissertation thesis. Faculty of Mathematics and Physics, Charles University.
Hladka, A., Martinkova, P., & Brabec, M. (2024). New iterative algorithms for estimation of item functioning. Journal of Educational and Behavioral Statistics. Online first, doi:10.3102/10769986241312354.
Examples
# loading data
data(GMAT)
y <- GMAT[, 1] # item 1
match <- scale(rowSums(GMAT[, 1:20])) # standardized total score
group <- GMAT[, "group"] # group membership variable
# formula for 3PL model with the same guessing for both groups,
# IRT parameterization
M <- formulaNLR(model = "3PLcg", type = "both", parameterization = "irt")
# starting values for 3PL model with the same guessing for item 1
start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "irt")
start <- start[[1]][M$M1$parameters]
# nonlinear least squares
(fit_nls <- estimNLR(
y = y, match = match, group = group,
formula = M$M1$formula, method = "nls",
lower = M$M1$lower, upper = M$M1$upper, start = start
))
coef(fit_nls)
logLik(fit_nls)
vcov(fit_nls)
vcov(fit_nls, sandwich = TRUE)
fitted(fit_nls)
residuals(fit_nls)
# maximum likelihood method
(fit_mle <- estimNLR(
y = y, match = match, group = group,
formula = M$M1$formula, method = "mle",
lower = M$M1$lower, upper = M$M1$upper, start = start
))
coef(fit_mle)
logLik(fit_mle)
vcov(fit_mle)
fitted(fit_mle)
residuals(fit_mle)
# formula for 3PL model with the same guessing for both groups
# intercept-slope parameterization
M <- formulaNLR(model = "3PLcg", type = "both", parameterization = "is")
# starting values for 3PL model with the same guessing for item 1,
start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "is")
start <- start[[1]][M$M1$parameters]
# EM algorithm
(fit_em <- estimNLR(
y = y, match = match, group = group,
formula = M$M1$formula, method = "em",
lower = M$M1$lower, upper = M$M1$upper, start = start
))
coef(fit_em)
logLik(fit_em)
vcov(fit_em)
fitted(fit_em)
residuals(fit_em)
# PLF algorithm
(fit_plf <- estimNLR(
y = y, match = match, group = group,
formula = M$M1$formula, method = "plf",
lower = M$M1$lower, upper = M$M1$upper, start = start
))
coef(fit_plf)
logLik(fit_plf)
vcov(fit_plf)
fitted(fit_plf)
residuals(fit_plf)
# iteratively reweighted least squares for 2PL model
M <- formulaNLR(model = "2PL", parameterization = "logistic")
(fit_irls <- estimNLR(
y = y, match = match, group = group,
formula = M$M1$formula, method = "irls"
))
coef(fit_irls)
logLik(fit_irls)
vcov(fit_irls)
fitted(fit_irls)
residuals(fit_irls)