sirt (version 3.9-4)

md.pattern.sirt: Response Pattern in a Binary Matrix

Description

Computes different statistics of the response pattern in a binary matrix.

Usage

md.pattern.sirt(dat)

Arguments

dat

A binary data matrix

Value

A list with following entries:

dat

Original dataset

dat.resp1

Indices for responses of 1's

dat.resp0

Indices for responses of 0's

resp_patt

Vector of response patterns

unique_resp_patt

Unique response patterns

unique_resp_patt_freq

Frequencies of unique response patterns

unique_resp_patt_firstobs

First observation in original dataset dat of a unique response pattern

freq1

Frequencies of 1's

freq0

Frequencies of 0's

dat.ordered

Dataset according to response patterns

See Also

See also the md.pattern function in the mice package.

Examples

Run this code
# NOT RUN {
#############################################################################
# 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")
# }

Run the code above in your browser using DataCamp Workspace