response person item category
10 1 1 1
1 1 1 2
01 1 1 3
01 1 1 4
01 1 1 5 (which is always true so should be omitted.)
De Boeck, P., Bakker, M., Zwitser, R., Nivard, M., Hofman, A., Tuerlinckx, F., & Partchev, I. (2011). The estimation of item response models with the lmer function from the lme4 package in R. Journal of Statistical Software, 39(12), 1-28.
====
Here's my source.
library(ltm)
#Science[c(1,3,4,7)]
Sci.df <- Science[c(1,3,4,7)] # Comfort, Work, Future, Benefit
Sci.df$id = 1:nrow(Sci.df)
Sci.long <- reshape(Sci.df, varying=colnames(Sci.df[-5]),
v.names="Response", timevar="item", idvar=c("id"), direction="long")
Sci.long$id <- as.factor(Sci.long$id)
Sci.long$item <- as.factor(Sci.long$item)
library(ordinal)
Sci.long.clmm <- clmm(Response ~ (1|id)+item, data=Sci.long, threshold="flexible", nAGQ=-21)
summary(Sci.long.clmm)
Positive1=as.integer(Sci.long$Response)<=1
Positive2=as.integer(Sci.long$Response)<=2
Positive3=as.integer(Sci.long$Response)<=3
Sci.long.sep1=Sci.long
Sci.long.sep1$Response=1; Sci.long.sep1$Positive=Positive1
Sci.long.sep2=Sci.long
Sci.long.sep2$Response=2; Sci.long.sep2$Positive=Positive2
Sci.long.sep3=Sci.long
Sci.long.sep3$Response=3; Sci.long.sep3$Positive=Positive3
Sci.long.sep = rbind(Sci.long.sep1, Sci.long.sep2, Sci.long.sep3)
Sci.long.sep$Response=as.factor(Sci.long.sep$Response)
Sci.long.sep.glmm <- glmer(Positive ~ -1 + Response + item + (1|id), data=Sci.long.sep, family=binomial,
nAGQ=21, control=glmerControl(optimizer="optimx",
optCtrl=list(method="nlminb"), check.conv.grad= .makeCC("warning", tol = 1e-4, relTol = NULL) ))
summary(Sci.long.sep.glmm)
I tried my best to make it same for clmm and glmer... but the log likelihood is different.
logLik = -1730.6 for glmer logLik = -1633.5 for clmm
and the parameters r not the same but similar.
Does anyone know why the log likehoods are different?