Learn R Programming

difNLR (version 1.3.7)

estimNLR: 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)

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) and "likelihood" for maximum likelihood method.

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.

Examples

Run this code
# NOT RUN {
data(GMAT)

# item 1
y <- GMAT[, 1]
match <- scale(rowSums(GMAT[, 1:20]))
group <- GMAT[, "group"]

# 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
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)
# }

Run the code above in your browser using DataLab