mult.choice {ltm}R Documentation

Multiple Choice Items to Binary Responses

Description

It converts multiple choice items to a matrix of binary responses.

Usage

mult.choice(data, correct)

Arguments

data

a matrix or a data.frame containing the manifest variables as columns.

correct

a vector of length ncol(data) with the correct responses.

Value

a matrix of 0/1 values indicating wrong/correct answers.

Author(s)

Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl

Examples


dat <- data.frame(It1 = sample(4, 100, TRUE),
                  It2 = sample(4, 100, TRUE),
                  It3 = sample(5, 100, TRUE),
                  It4 = sample(5, 100, TRUE),
                  It5 = sample(4, 100, TRUE),
                  It6 = sample(5, 100, TRUE))
dat[] <- lapply(dat, function (x) { x[sample(100, 4)] <- NA; x })
crct <- c(3, 2, 5, 3, 4, 5)
####################
mult.choice(dat, crct)


[Package ltm version 1.2-0 Index]