5.8 M-step

Based on the quantities calculated from the E-step, the M-step estimates item parameters of all items. For item \(j\), we have

\[\begin{equation} \hat{g}_j=\frac{R_j^{(0)}}{N_j^{(0)}} \end{equation}\] \[\begin{equation} \hat{s}_j=1-\frac{R_j^{(1)}}{N_j^{(1)}} \end{equation}\] For item 5,

Code
Nj0 <- sum(P.alphac.given.yi[, 1:3])
Nj1 <- sum(P.alphac.given.yi[, 4])
Rj0 <- sum(y[, 5] * rowSums(P.alphac.given.yi[, 1:3]))
Rj1 <- sum(y[, 5] * P.alphac.given.yi[, 4])

g5 <- Rj0/Nj0
s5 <- 1 - Rj1/Nj1
## Item 5 guessing = 0.47 
## Item 5 slip = 0.25

Exercise 5.4 Find the estimated guessing and slip parameters for item 1.

Click for Answer
Code
Nj0 <- sum(P.alphac.given.yi[, 1:3])
Nj1 <- sum(P.alphac.given.yi[, 4])
Rj0 <- sum(y[, 1] * rowSums(P.alphac.given.yi[, 1:3]))
Rj1 <- sum(y[, 1] * P.alphac.given.yi[, 4])


g1 <- Rj0/Nj0
s1 <- 1 - Rj1/Nj1

cat("Item 1 guessing =", g1, "\nItem 1 slip =", s1)
## Item 1 guessing = 0.39 
## Item 1 slip = 0.38