sim_rrum_items: Generate data from the rRUM

Description Usage Arguments Value Author(s) References Examples

View source: R/RcppExports.R

Description

Randomly generate response data according to the reduced Reparameterized Unified Model (rRUM).

Usage

1
sim_rrum_items(Q, rstar, pistar, alpha)

Arguments

Q

A matrix with J rows and K columns indicating which attributes are required to answer each of the items, where J represents the number of items and K the number of attributes. An entry of 1 indicates attribute k is required to answer item j. An entry of one indicates attribute k is not required.

rstar

A matrix a matrix with J rows and K columns indicating the penalties for failing to have each of the required attributes, where J represents the number of items and K the number of attributes. rstar and Q must share the same 0 entries.

pistar

A vector of length J indicating the probabiliies of answering each item correctly for individuals who do not lack any required attribute, where J represents the number of items.

alpha

A matrix with N rows and K columns indicating the subjects attribute acquisition, where K represents the number of attributes. An entry of 1 indicates individual i has attained attribute k. An entry of 0 indicates the attribute has not been attained.

Value

Y A matrix with N rows and J columns indicating the indviduals' responses to each of the items, where J represents the number of items.

Author(s)

Steven Andrew Culpepper, Aaron Hudson, and James Joseph Balamuta

References

Culpepper, S. A. & Hudson, A. (In Press). An improved strategy for Bayesian estimation of the reduced reparameterized unified model. Applied Psychological Measurement.

Hudson, A., Culpepper, S. A., & Douglas, J. (2016, July). Bayesian estimation of the generalized NIDA model with Gibbs sampling. Paper presented at the annual International Meeting of the Psychometric Society, Asheville, North Carolina.

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
# Set seed for reproducibility
set.seed(217)

# Define Simulation Parameters
N = 1000 # number of individuals
J = 6 # number of items
K = 2 # number of attributes

# Matrix where rows represent attribute classes
As = attribute_classes(K) 

# Latent Class probabilities
pis = c(.1, .2, .3, .4) 

# Q Matrix
Q = rbind(c(1, 0),
          c(0, 1),
          c(1, 0),
          c(0, 1),
          c(1, 1),
          c(1, 1)
    )
    
# The probabiliies of answering each item correctly for individuals 
# who do not lack any required attribute
pistar = rep(.9, J)

# Penalties for failing to have each of the required attributes
rstar  = .5 * Q

# Randomized alpha profiles
alpha  = As[sample(1:(K ^ 2), N, replace = TRUE, pis),]

# Simulate data
rrum_items = sim_rrum_items(Q, rstar, pistar, alpha)

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