simulate_answer: Simulate answer

Description Usage Arguments Value Examples

Description

Simulate answer on specified items, given true theta.

Usage

1
simulate_answer(theta, model, alpha, beta, guessing, item_keys)

Arguments

theta

Vector with true theta.

model

One of "3PLM", "GPCM", "SM" or "GRM", for the three-parameter logistic, generalized partial credit, sequential or graded response model, respectively.

alpha

Matrix of alpha parameters, one column per dimension, one row per item. Row names should contain the item keys. Note that so called within-dimensional models still use an alpha matrix, they simply have only one non-zero loading per item.

beta

Matrix of beta parameters, one column per item step, one row per item. Row names should contain the item keys. Note that shadowcat expects answer categories to be sequential, and without gaps. That is, the weight parameter in the GPCM model is assumed to be sequential, and equal to the position of the 'location' of the beta parameter in the beta matrix. The matrix should have a number of columns equal to the largest number of item steps over items, items with fewer answer categories should be right-padded with NA. NA values between answer categories are not allowed, and will lead to errors.

guessing

Matrix with one column of guessing parameters per item. Row names should contain the item keys. Optionally used in 3PLM model, ignored for all others.

item_keys

Character vector of item keys for which answers should be simulated.

Value

Vector with responses.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
alpha_beta <- simulate_testbank(model = "3PLM", number_items = 50, 
                                number_dimensions = 1, number_itemsteps = 1)
guessing <- matrix(rep(.5, 50), dimnames = list(rownames(alpha_beta$alpha), NULL))

# Without guessing parameter
simulate_answer(theta = .3, model = "3PLM", alpha = alpha_beta$alpha, 
                beta = alpha_beta$beta, guessing = NULL, item_keys = "item3")

# With guessing parameter
simulate_answer(theta = .3, model = "3PLM", alpha = alpha_beta$alpha,
                beta = alpha_beta$beta, guessing = guessing, item_keys = "item3")

# Simulate answers for more than one item
simulate_answer(theta = .3, model = "3PLM", alpha = alpha_beta$alpha, 
                beta = alpha_beta$beta, guessing = NULL, 
                item_keys = c("item5", "item2", "item8", "item1", "item18"))

Karel-Kroeze/ShadowCAT documentation built on May 7, 2019, 12:28 p.m.