sim_dina_items: Simulation Responses from the DINA model

Description Usage Arguments Value Author(s) See Also Examples

View source: R/RcppExports.R

Description

Sample responses from the DINA model for given attribute profiles, Q matrix, and item parmeters. Returns a matrix of dichotomous responses generated under DINA model.

Usage

1
sim_dina_items(alphas, Q, ss, gs)

Arguments

alphas

A N by K matrix of latent attributes.

Q

A J by K matrix indicating which skills are required for which items.

ss

A J vector of item slipping parameters.

gs

A J vector of item guessing parameters.

Value

A N by J matrix of responses from the DINA model.

Author(s)

Steven Andrew Culpepper and James Joseph Balamuta

See Also

simcdm::sim_dina_class() and simcdm::sim_dina_attributes()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
N = 200
K = 5
J = 30
delta0 = rep(1, 2 ^ K)

# Creating Q matrix
Q = matrix(rep(diag(K), 2), 2 * K, K, byrow = TRUE)
for (mm in 2:K) {
  temp = combn(seq_len(K), m = mm)
  tempmat = matrix(0, ncol(temp), K)
  for (j in seq_len(ncol(temp)))
    tempmat[j, temp[, j]] = 1
  Q = rbind(Q, tempmat)
}
Q = Q[seq_len(J), ]

# Setting item parameters and generating attribute profiles
ss = gs = rep(.2, J)
PIs = rep(1 / (2 ^ K), 2 ^ K)
CLs = c((1:(2 ^ K)) %*% rmultinom(n = N, size = 1, prob = PIs))

# Defining matrix of possible attribute profiles
As = rep(0, K)
for (j in seq_len(K)) {
  temp = combn(1:K, m = j)
  tempmat = matrix(0, ncol(temp), K)
  for (j in seq_len(ncol(temp)))
    tempmat[j, temp[, j]] = 1
  As = rbind(As, tempmat)
}
As = as.matrix(As)

# Sample true attribute profiles
Alphas = As[CLs, ]

# Simulate item data under DINA model 
dina_items = sim_dina_items(Alphas, Q, ss, gs)

# Simulate attribute data under DINA model 
dina_attributes = sim_dina_attributes(Alphas, Q)

Example output



simcdm documentation built on May 2, 2019, 9:09 a.m.