estimNLR: Non-linear regression DIF models estimation.

View source: R/estimNLR.R

estimNLRR 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 ("1" correct, "0" incorrect).

match

numeric: a numeric vector describing the matching criterion.

group

numeric: a binary vector of a group membership ("0" for the reference group, "1" for the focal group).

formula

formula: specification of the model. It can be obtained by the formulaNLR() function.

method

character: an estimation method to be applied. The options are "nls" for non-linear least squares (default), "mle" for the maximum likelihood method using the "L-BFGS-B" algorithm with constraints, "em" for the maximum likelihood estimation with the EM algorithm, "plf" for the maximum likelihood estimation with the algorithm based on parametric link function, and "irls" for the maximum likelihood estimation with the iteratively reweighted least squares algorithm (available for the "2PL" model only). See Details.

lower

numeric: lower bounds for item parameters of the model specified in the formula.

upper

numeric: upper bounds for item parameters of the model specified in the formula.

start

numeric: initial values of item parameters. They can be obtained by the startNLR() function.

object

an object of the "estimNLR" class.

...

other generic parameters for S3 methods.

x

an object of the "estimNLR" class.

sandwich

logical: should the sandwich estimator be applied for computation of the covariance matrix of item parameters when using method = "nls"? (the default is FALSE).

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, \Sexpr[results=rd]{tools:::Rd_expr_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, \Sexpr[results=rd]{tools:::Rd_expr_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. Accepted.

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)

adelahladka/difNLR documentation built on Dec. 23, 2024, 2:20 a.m.