Created
March 8, 2024 16:52
-
-
Save jeffreypullin/eab57ccd47d02961afc056aed423b1e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rater) | |
# We have 'Unsure' ratings for the first three patients. | |
# We encode 'Unsure' = category 5. | |
anesthesia_w_unsure <- anesthesia | |
anesthesia_w_unsure[anesthesia$item %in% 1:3, "rating"] <- 5 | |
# Taken from the rater() function's code. | |
J <- 5 | |
K <- 4 + 1 | |
N <- 8 | |
p <- 0.6 | |
on_diag <- N * p | |
off_diag <- N * (1 - p) / (K - 1) | |
beta_slice <- matrix(off_diag, nrow = K, ncol = K) | |
diag(beta_slice) <- on_diag | |
beta <- array(dim = c(J,K,K)) | |
for (j in 1:5) { | |
beta[j, , ] <- beta_slice | |
} | |
for (j in 1:5) { | |
for (k in 1:5) { | |
# Value will need tweaking! | |
beta[j, k, ] <- rep(2, 5) | |
} | |
} | |
fit_w_unsure <- rater(anesthesia_w_unsure, | |
dawid_skene(beta = beta)) | |
fit <- rater(anesthesia, "dawid_skene") | |
plot(fit, "theta") | |
plot(fit_w_unsure, "theta") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment