the Pearson chi^2 is not directly computed in 'ltm', and the reason is
that both the Pearson chi^2 and the likelihood-ratio statistics do not
follow the claimed chi-squared distribution, especially as the number
of items increases. If you still need to compute it, then you can use
the following simple function:
chisq.irt <- function (object) {
if (!class(object) %in% c("ltm", "rasch",
"tpm"))
stop("Use only with 'ltm', 'rasch' or 'tpm'
objects.\n")
nam.obj <- deparse(substitute(object))
p <- ncol(object$X)
X <- expand.grid(rep(list(c(0, 1)), p))
res <- residuals(object, resp.patterns = data.matrix(X))
Tstat <- sum((res[, "Resid"])^2)
df <- 2^p - attr(logLik(object), "df") - 1
pval <- pchisq(Tstat, df, lower.tail = FALSE)
names(Tstat) <- "X^2"
names(df) <- "df"
rval <- list(statistic = Tstat, parameter = df, p.value = pval,
alternative = "the fitted IRT model is not appropriate for the
data set",
method = "Pearson X^2 for IRT Models",
data.name = paste("data from model '", nam.obj,
"'", sep =
""))
class(rval) <- "htest"
rval
}
# Some examples
library(ltm)
fitRasch <- rasch(LSAT, constraint = cbind(length(LSAT) + 1, 1))
fit1PL <- rasch(LSAT)
fit2PL <- ltm(LSAT ~ z1)
chisq.irt(fitRasch)
chisq.irt(fit1PL)
chisq.irt(fit2PL)
# check also which perform a Bootstrap approximation
# to the distribution of the statistic uner the null
GoF.rasch(fitRasch)
GoF.rasch(fit1PL)
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Davood Tofighi" <dtofighi at asu.edu>
To: <r-help at r-project.org>
Sent: Monday, March 10, 2008 4:16 AM
Subject: [R] ltm package question
> Hello All,
>
> I was wondering how I can get the overall Pearson chi^2 test of
> model fit
> with its df and p value in the LTM package for the 2PL models.
>
> Thanks,
>
> --
> Davood Tofighi
> Department of Psychology
> Arizona State University
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm