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.

Usage

estimNLR(y, match, group, formula, method, lower, upper, start)

## S3 method for class 'estimNLR'
print(x, ...)

## S3 method for class 'estimNLR'
vcov(object, sandwich = FALSE, ...)

Arguments

y

numeric: binary vector of responses.

match

numeric: vector of matching criterion.

group

numeric: binary vector of group membership. "0" for reference group, "1" for focal group.

formula

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

method

character: method used to estimate parameters. The options are "nls" for non-linear least squares (default), "likelihood" for maximum likelihood method, and "irls" for maximum likelihood estimation with iteratively reweighted least squares. See Details.

lower

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

upper

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

start

numeric: initial parameters. Can be obtained by startNLR() function.

x

an object of "estimNLR" class.

...

other generic parameters for S3 methods.

object

an object of "estimNLR" class.

sandwich

logical: should be sandwich estimator used for covariance matrix of parameters when using method = "nls"? Default is FALSE.

Details

Function offers either non-linear least squares estimation via nls function, maximum likelihood method with "L-BFGS-B" method via optim function, or maximum likelihood method with iteratively reweighted least squares via glm function.

Author(s)

Adela Hladka (nee Drabinova)
Institute of Computer Science of the Czech Academy of Sciences
Faculty of Mathematics and Physics, Charles University
hladka@cs.cas.cz

Patricia Martinkova
Institute of Computer Science of the Czech Academy of Sciences
martinkova@cs.cas.cz

References

Hladka, A. (2021). Statistical models for detection of differential item functioning. Dissertation thesis. Faculty of Mathematics and Physics, Charles University.

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
M <- formulaNLR(model = "3PLcg", type = "both")

# starting values for 3PL model with the same guessing for item 1
start <- startNLR(GMAT[, 1:20], group, model = "3PLcg", parameterization = "classic")
start <- start[[1]][M$M0$parameters]

# non-linear least squares
fitNLSM0 <- estimNLR(
  y = y, match = match, group = group,
  formula = M$M0$formula, method = "nls",
  lower = M$M0$lower, upper = M$M0$upper, start = start
)
fitNLSM0

coef(fitNLSM0)
logLik(fitNLSM0)
vcov(fitNLSM0)
vcov(fitNLSM0, sandwich = TRUE)
fitted(fitNLSM0)
residuals(fitNLSM0)

# maximum likelihood method
fitLKLM0 <- estimNLR(
  y = y, match = match, group = group,
  formula = M$M0$formula, method = "likelihood",
  lower = M$M0$lower, upper = M$M0$upper, start = start
)
fitLKLM0

coef(fitLKLM0)
logLik(fitLKLM0)
vcov(fitLKLM0)
fitted(fitLKLM0)
residuals(fitLKLM0)

# iteratively reweighted least squares for 2PL model
M <- formulaNLR(model = "2PL", parameterization = "logistic")
fitIRLSM1 <- estimNLR(
  y = y, match = match, group = group,
  formula = M$M1$formula, method = "irls"
)
fitIRLSM1

coef(fitIRLSM1)
logLik(fitIRLSM1)
vcov(fitIRLSM1)
fitted(fitIRLSM1)
residuals(fitIRLSM1)

difNLR documentation built on May 3, 2023, 5:11 p.m.