Multi-level Rasch Model Per Douglas Bates' paper
? I'd have to look at this more carefully, but something like that.? It's more robust and easier to understand if you use labels rather than numbers, e.g. ?? coef(m1)$cond$item[["(Intercept)"]] ?? (if in doubt, use str(coef(m1)) to see how the pieces are arranged and labeled)
On 5/13/20 1:45 PM, Simon Harmel wrote:
I meant *easiness *<- *coef(m1)[[1]][[1]][1]* *persons
<-?coef(m1)[[1]][[2]][1]*
On Wed, May 13, 2020 at 12:43 PM Simon Harmel <sim.harmel at gmail.com
<mailto:sim.harmel at gmail.com>> wrote:
Ben,
This is exactly what I'm trying to understand?for my glmmTMB
models in my original post ('m1' & 'm2').
So to get the item easiness I think we need to use: *easiness *<-
*coef(f11)[[1]][[1]][1]*
*? ? ? ? ? ? ? ? ? ? ? ? ? ? ? persons <-?coef(f11)[[1]][[2]][1]*
*
*
Am I right Ben?
On Wed, May 13, 2020 at 12:32 PM Ben Bolker <bbolker at gmail.com
<mailto:bbolker at gmail.com>> wrote:
??? Apologies for not looking this over in great detail, but
not sure
why you're mixing lme4 and glmmTMB here??? Isn't item easiness
just
lme4::coef(fm2)$item ?
easiness <-
? ?lme4::ranef(fm2)$item[[1]] +
? ?glmmTMB::fixef(fm2)[imap$itype])
On 5/13/20 1:25 PM, Rasmus Liland wrote:
> On 2020-05-13 18:50 +0200, Rasmus Liland wrote:
>> Indeed it does work now!? Thanks!
> Right, so this code reproduces code until the
> easiness variable on page 15.? Perhaps this
> is useful?
>
> data("lq2002", package="multilevel")
> wrk <- lq2002
> # wrk[1:5,]
> for (i in 3:16) wrk[[i]] <- ordered(wrk[[i]])
> for (i in 17:21) wrk[[i]] <- ordered(5 - wrk[[i]])
> lql <- reshape(wrk,
>? ? varying = list(names(lq2002)[3:21]),
>? ? v.names = "fivelev",
>? ? idvar = "subj",
>? ? timevar = "item",
>? ? drop = names(lq2002)[c(2, 22:27)],
>? ? direction = "long")
> lql$itype <-
>? ? with(lql, factor(ifelse(item < 12, "Leadership",
>? ? ? ifelse(item < 15, "Task Sig.", "Hostility")
>? ? )))
> for (i in c(1, 2, 4, 5)) lql[[i]] <- factor(lql[[i]])
> lql$dichot <- factor(ifelse(lql$fivelev < 4, 0, 1))
> # str(lql)
> # summary(lql)
>
> ## 3.2 Fitting an initial multilevel Rasch model
> (fm1 <- lme4::glmer(
>? ? dichot ~ 0 + itype + (1 | subj) +
>? ? ? (1 | COMPID) +
>? ? ? (1 | item),
>? ? lql,
>? ? binomial))
> rr <- lme4::ranef(fm1, condVar = TRUE)
> str(rr$COMPID)
> head(rr$COMPID)
>
> qq <- lattice::qqmath(rr)
> print(qq$subj)
>
> ## 3.3 Allowing for interactions of company and item type
> (fm2 <- lme4::glmer(
>? ? dichot ~ 0 + itype + (1 | subj) +
>? ? ? (0 + itype | COMPID) +
>? ? ? (1 | item),
>? ? lql,
>? ? binomial))
>
> (fm3 <- lme4::glmer(
>? ? dichot ~ 0 + itype + (1 | subj) +
>? ? ? (1 | COMPID:itype) +
>? ? ? (1 | item),
>? ? lql,
>? ? binomial))
>
> (fm3a <- lme4::glmer(
>? ? dichot ~ 0 + itype + (1 | subj) +
>? ? ? (1 | COMPID:itype) +
>? ? ? (1 | COMPID) +
>? ? ? (1 | item),
>? ? lql,
>? ? binomial))
>
> anova(fm3, fm3a, fm2)
>
> str(imap <- unique(lql[, c("itype", "item")]))
>
> (easiness <-
>? ? lme4::ranef(fm2)$item[[1]] +
>? ? glmmTMB::fixef(fm2)[imap$itype])
>
> Best,
> Rasmus
>
> _______________________________________________
> R-sig-mixed-models at r-project.org
<mailto:R-sig-mixed-models at r-project.org> mailing list
_______________________________________________
R-sig-mixed-models at r-project.org
<mailto:R-sig-mixed-models at r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models