# 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