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

IRT.data

S3 Method for Extracting Used Item Response Dataset


Description

This S3 method extracts the used dataset with item responses.

Usage

IRT.data(object, ...)

## S3 method for class 'din'
IRT.data(object, ...)

## S3 method for class 'gdina'
IRT.data(object, ...)

## S3 method for class 'gdm'
IRT.data(object, ...)

## S3 method for class 'mcdina'
IRT.data(object, ...)

## S3 method for class 'reglca'
IRT.data(object, ...)

## S3 method for class 'slca'
IRT.data(object, ...)

Arguments

object

Object of classes din, gdina, mcdina, gdm, slca, reglca.

...

More arguments to be passed.

Value

A matrix (or data frame) with item responses and group identifier and weights vector as attributes.

Examples

## Not run: 
#############################################################################
# EXAMPLE 1: Several models for sim.dina data
#############################################################################

data(sim.dina, package="CDM")
data(sim.qmatrix, package="CDM")

dat <- sim.dina
q.matrix <- sim.qmatrix

#--- Model 1: GDINA model
mod1 <- CDM::gdina( data=dat, q.matrix=q.matrix)
summary(mod1)
dmod1 <- CDM::IRT.data(mod1)
str(dmod1)

#--- Model 2: DINA model
mod2 <- CDM::din( data=dat, q.matrix=q.matrix)
summary(mod2)
dmod2 <- CDM::IRT.data(mod2)

#--- Model 3: Rasch model with gdm function
mod3 <- CDM::gdm( data=dat, irtmodel="1PL", theta.k=seq(-4,4,length=11),
                centered.latent=TRUE )
summary(mod3)
dmod3 <- CDM::IRT.data(mod3)

#--- Model 4: Latent class model with two classes

dat <- sim.dina
I <- ncol(dat)

# define design matrices
TP <- 2     # two classes
# The idea is that latent classes refer to two different "dimensions".
# Items load on latent class indicators 1 and 2, see below.
Xdes <- array(0, dim=c(I,2,2,2*I) )
items <- colnames(dat)
dimnames(Xdes)[[4]] <- c(paste0( colnames(dat), "Class", 1),
          paste0( colnames(dat), "Class", 2) )
    # items, categories, classes, parameters
# probabilities for correct solution
for (ii in 1:I){
    Xdes[ ii, 2, 1, ii ] <- 1    # probabilities class 1
    Xdes[ ii, 2, 2, ii+I ] <- 1  # probabilities class 2
}
# estimate model
mod4 <- CDM::slca( dat, Xdes=Xdes)
summary(mod4)
dmod4 <- CDM::IRT.data(mod4)

## End(Not run)

CDM

Cognitive Diagnosis Modeling

v7.5-15
GPL (>= 2)
Authors
Alexander Robitzsch [aut, cre], Thomas Kiefer [aut], Ann Cathrice George [aut], Ali Uenlue [aut]
Initial release
2020-03-10 14:19:21

We don't support your browser anymore

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