View source: R/md.pattern.sirt.R
md.pattern.sirt | R Documentation |
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:
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
|
freq1 |
Frequencies of 1's |
freq0 |
Frequencies of 0's |
dat.ordered |
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.