Generates response vectors for n
cases to i
items given
known item parameters, person abilities, and (optionally) other inputs.
genResponses(
abilities,
groups = NULL,
itemParams,
BMatrix = 1,
mcarP = 0,
perturbR = NULL
)
A matrix, n
cases by i
items, of scored item responses.
A person by latent-dimension matrix of abilities. One column per dimension.
A vector of factors of the same length as abilities
that
allocates each case to a group. Used in perturbR. Defaults to NULL such that
all cases are in the one group.
A list of item parameters of the structure used in simplef
(a matrix of k categories by four (category score, delta dot, tau, discrimination)).
See conquestr::makeItemList for a helper to generate this list.
A simplified B-matrix mapping dimensions (columns) to items (rows). Or the integer "1" if items are dichotomous and ability is uni-dimensional.
A double indicating the proportion of missing data under the MCAR assumption.
A list of lists, where each element of the list refers to one item and contains a list of elements describing how responses to that item should be perturbed to model misfit. Each element of the list should contain, in order:
item number (int). Which item in itemParams
is affected,
type of perturbation (string) to apply. One of
"discrimination" - increasing or decreases the discrimination
...more to come, like "shift"
perturbation factor (double). When the type is "discrimination", this defines the scale that the discrimination is increased or decreased. For example, if the item has discrimination of 1, and the perturbation factor is 1.2, the resulting probabilities will be calculated assuming the discrimination is 1 * 1.2 = 1.2.
pivot point (double), When the type is "discrimination", this defines the location around which the perturbation is applied relative to the delta dot. That is, when the type is "discrimination" and the "perturbation factor" is > 1, probabilities above the pivot point will be overestimated (generated responses will higher than expectation) and probabilities below the pivot point will be underestimated (generated responses will lower than expectation). When the pivot point is 0, this calculation happens at the item location parameter (e.g., at the category boundary).
group (string). The group found in groups that should be perturbed. note that is
groupsis not used in call to
genResponses` than this
value is ignored and all cases' responses are perturbed.
simplef()
, browseVignettes("conquestr")
myItem <- matrix(c(0, 0, 0, 0, 1, 1, 0, 1), ncol = 4, byrow = TRUE)
myItems <- list(myItem, myItem)
myItems[[2]][2, 2] <- -1 # make the second item delta equal to -1
myResponses <- genResponses(abilities = rnorm(100), itemParams = myItems)
Run the code above in your browser using DataLab