md.pattern.sirt.Rd
Computes different statistics of the response pattern in a binary matrix.
md.pattern.sirt(dat)
dat | A binary data matrix |
---|
A list with following entries:
Original dataset
Indices for responses of 1's
Indices for responses of 0's
Vector of response patterns
Unique response patterns
Frequencies of unique response patterns
First observation in original dataset
dat
of a unique response pattern
Frequencies of 1's
Frequencies of 0's
Dataset according to response patterns
See also the md.pattern
function in the mice package.
############################################################################# # EXAMPLE 1: Response patterns ############################################################################# set.seed(7654) N <- 21 # number of rows I <- 4 # number of columns dat <- matrix( 1*( stats::runif(N*I) > .3 ), N, I ) res <- sirt::md.pattern.sirt(dat) # plot of response patterns res$dat.ordered image( z=t(res$dat.ordered), y=1:N, x=1:I, xlab="Items", ylab="Persons") # 0's are yellow and 1's are red ############################################################################# # EXAMPLE 2: Item response patterns for dataset data.read ############################################################################# data(data.read) dat <- data.read ; N <- nrow(dat) ; I <- ncol(dat) # order items according to p values dat <- dat[, order(colMeans(dat, na.rm=TRUE )) ] # analyzing response pattern res <- sirt::md.pattern.sirt(dat) res$dat.ordered image( z=t(res$dat.ordered), y=1:N, x=1:I, xlab="Items", ylab="Persons")