sim_rrum_items {simcdm}R Documentation

Generate data from the rRUM

Description

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

Usage

sim_rrum_items(Q, rstar, pistar, alpha)

Arguments

Q

A matrix with JJ rows and KK columns indicating which attributes are required to answer each of the items, where JJ represents the number of items and KK the number of attributes. An entry of 1 indicates attribute kk is required to answer item jj. An entry of one indicates attribute kk is not required.

rstar

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

pistar

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

alpha

A matrix with NN rows and KK columns indicating the subjects attribute acquisition, where KK represents the number of attributes. An entry of 1 indicates individual ii has attained attribute kk. An entry of 0 indicates the attribute has not been attained.

Value

Y A matrix with NN rows and JJ columns indicating the indviduals' responses to each of the items, where JJ 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

# 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)

[Package simcdm version 0.1.2 Index]