estimNLR {difNLR} | R Documentation |
Estimates parameters of non-linear regression models for DIF detection using either non-linear least squares or maximum likelihood method.
estimNLR(y, match, group, formula, method, lower, upper, start)
y |
numeric: binary vector of responses. |
match |
numeric: vector of matching criterion. |
group |
numeric: binary vector of group membership. |
formula |
formula: specification of the model. Can be obtained by |
method |
character: method used to estimate parameters. The options are |
lower |
numeric: lower bounds for parameters of model specified in |
upper |
numeric: upper bounds for parameters of model specified in |
start |
numeric: initial parameters. Can be obtained by |
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.
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
Hladka, A. (2021). Statistical models for detection of differential item functioning. Dissertation thesis. Faculty of Mathematics and Physics, Charles University.
# 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)