Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mult.choice

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)

ltm

Latent Trait Models under IRT

v1.1-1
GPL (>= 2)
Authors
Dimitris Rizopoulos <d.rizopoulos@erasmusmc.nl>
Initial release
2018-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.