Skip to content

Instantly share code, notes, and snippets.

View itan.R
itan <- function(x, keys=NULL, digits=3, no.resp=4) {
# x is an n subjects by k items matrix
# keys is a vector with the correct keys (A, B, C, D)
stopifnot(ncol(x)>1)
if (is.null(keys)) keys <- rep("A", ncol(x))
require(ltm)
raw.resp <- matrix(nr=ncol(x), nc=no.resp)
colnames(raw.resp) <- LETTERS[1:no.resp]
for (i in 1:ncol(x)) {
tmp <- table(x[,i])