# Overview

Within this document, we highlight the different features of the simcdm package as it relates to simulating cognitive diagnostic modeling data.

## Notation

For consistency, we aim to use the following notation.

Denoting individuals:

• $$N$$ is the total number of individuals taking the assessment.
• $$i$$ is the current individual.

Denoting items:

• $$J$$ is the total number of items on the assessment.
• $$j$$ is the current item
• $$Y_{ij}$$ is the observed binary response for individual $$i$$ ($$1\leq i \leq N$$) to item $$j$$ ($$1\leq j\leq J$$).
• $$s_j$$ is the probability of slipping on item $$j$$.
• $$g_j$$ is the probability of guessing on item $$j$$.

Denoting attributes:

• $$K$$ is the total number of attributes for the assessment item.
• $$k$$ is the current attribute.
• $$\boldsymbol\alpha_i=\left(\alpha_{i1},\dots,\alpha_{iK}\right)^\prime$$ where $$\boldsymbol\alpha_i\in \left\{0,1\right\}^K$$ and $$\alpha_{ik}$$ is the latent binary attribute for individual $$i$$ on attribute $$k$$ ($$1\leq k\leq K$$).

Denoting the skill/attribute “Q” matrix:

• $$\boldsymbol q_{j}=\left(q_{j1},\dots,q_{jK}\right)^\prime$$ be the $$j$$th row of $$\boldsymbol Q$$ such that $$q_{jk}=1$$ if attribute $$k$$ is required for item $$j$$ and zero otherwise.

# Usage

library(simcdm)

## Matrix Simulation

Simulations within this section are done underneath the following settings.

### Identifiable Q Matrix Simulation

Simulate an identifiable $$Q$$ matrix ($$J$$ items by $$K$$ skills).

##       [,1] [,2]
##  [1,]    1    0
##  [2,]    1    0
##  [3,]    0    1
##  [4,]    0    1
##  [5,]    0    1
##  [6,]    0    1
##  [7,]    1    1
##  [8,]    1    0
##  [9,]    1    0
## [10,]    0    1

### $$\eta$$ Matrix Simulation

Create the ideal response matrix for each trait ($$J$$ items by $$2^K$$ latent classes).

##       [,1] [,2] [,3] [,4]
##  [1,]    0    0    1    1
##  [2,]    0    0    1    1
##  [3,]    0    1    0    1
##  [4,]    0    1    0    1
##  [5,]    0    1    0    1
##  [6,]    0    1    0    1
##  [7,]    0    0    0    1
##  [8,]    0    0    1    1
##  [9,]    0    0    1    1
## [10,]    0    1    0    1

### Attribute profile simulation

Generate latent attribute profile classes ($$2^K$$ latent classes by $$K$$ skills).

##      [,1] [,2]
## [1,]    0    0
## [2,]    0    1
## [3,]    1    0
## [4,]    1    1

Generate latent attribute profile class for each subject ($$N$$ subjects by $$K$$ skills).

##       [,1] [,2]
##  [1,]    0    0
##  [2,]    1    1
##  [3,]    1    0
##  [4,]    1    1
##  [5,]    0    0
##  [6,]    0    1
##  [7,]    0    1
##  [8,]    1    0
##  [9,]    0    1
## [10,]    0    1
## [11,]    0    1
## [12,]    0    1
## [13,]    1    0
## [14,]    0    0
## [15,]    1    0

### DINA Item Simulation

Simulate item data, $$Y$$, under DINA model ($$N$$ by $$J$$)

##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
##  [1,]    0    0    0    1    1    0    0    0    1     1
##  [2,]    1    1    1    0    1    1    1    1    0     1
##  [3,]    0    0    0    0    1    0    0    0    1     1
##  [4,]    1    1    1    0    0    0    1    1    1     0
##  [5,]    1    1    1    1    1    1    1    1    1     1
##  [6,]    1    1    1    1    0    1    0    1    0     1
##  [7,]    0    0    0    1    1    0    0    0    0     1
##  [8,]    1    0    1    1    1    0    0    1    0     1
##  [9,]    1    1    1    1    0    1    1    1    1     1
## [10,]    0    1    0    1    1    0    0    0    1     1
## [11,]    1    1    1    1    1    1    1    0    1     1
## [12,]    0    0    0    0    1    0    0    0    1     0
## [13,]    0    0    0    0    1    0    0    0    1     1
## [14,]    1    0    0    1    1    0    0    0    0     0
## [15,]    1    1    0    1    0    0    1    1    0     0

### DINA Attribute Simulation

Simulate attribute data under DINA model ($$N$$ by $$J$$)

##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
##  [1,]    0    0    0    1    1    0    0    0    1     1
##  [2,]    1    1    1    1    1    1    1    1    1     1
##  [3,]    0    0    0    1    1    0    0    0    1     1
##  [4,]    1    1    1    0    0    0    1    1    0     0
##  [5,]    1    1    1    1    1    1    1    1    1     1
##  [6,]    1    1    1    1    1    1    1    1    1     1
##  [7,]    0    0    0    1    1    0    0    0    1     1
##  [8,]    1    1    1    1    1    1    1    1    1     1
##  [9,]    1    1    1    1    1    1    1    1    1     1
## [10,]    0    0    0    1    1    0    0    0    1     1
## [11,]    1    1    1    1    1    1    1    1    1     1
## [12,]    0    0    0    1    1    0    0    0    1     1
## [13,]    0    0    0    1    1    0    0    0    1     1
## [14,]    0    0    0    0    0    0    0    0    0     0
## [15,]    1    1    1    0    0    0    1    1    0     0

## rRUM Simulation

The rRUM simulations are done using the following settings.

### Simulate rRUM items

Simulate rRUM item data $$Y$$ ($$N$$ by $$J$$)

##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
##  [1,]    1    1    1    0    1    0    1    1    1     0
##  [2,]    1    1    0    1    1    0    1    0    0     0
##  [3,]    0    1    1    1    0    1    1    1    0     0
##  [4,]    0    1    1    1    0    1    1    1    1     0
##  [5,]    1    1    0    0    1    0    1    1    1     0
##  [6,]    1    1    1    1    0    0    1    1    0     1
##  [7,]    1    0    1    0    1    0    0    0    0     1
##  [8,]    0    0    1    0    0    0    1    0    0     1
##  [9,]    0    1    0    1    1    1    0    1    1     0
## [10,]    1    1    1    1    0    0    0    1    1     0
## [11,]    1    1    1    0    0    0    1    1    0     1
## [12,]    0    1    0    1    1    0    1    1    1     1
## [13,]    1    0    1    1    1    0    1    1    1     1
## [14,]    1    0    1    1    1    1    1    1    1     1
## [15,]    0    0    1    0    1    1    1    1    1     1