genResponses {conquestr}R Documentation

genResponses

Description

Generates response vectors for n cases to i items given known item parameters, person abilities, and (optionally) other inputs.

Usage

genResponses(
  abilities,
  groups = NULL,
  itemParams,
  BMatrix = 1,
  mcarP = 0,
  perturbR = NULL
)

Arguments

abilities

A person by latent-dimension matrix of abilities. One column per dimension.

groups

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.

itemParams

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.

BMatrix

A simplified B-matrix mapping dimensions (columns) to items (rows). Or the integer "1" if items are dichotomous and ability is uni-dimensional.

mcarP

A double indicating the proportion of missing data under the MCAR assumption.

perturbR

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" - increases or decreases the discrimination of the item at a location specified by the user.

    • "shift" - increases or decreases the location of the item as to create a uniform shift in the CCC.

    • ...more to come,

  • scoring 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. Note that is the value given here is 1, than this kind of perturbation is the same as "shift". When the type is "shift" this value is always ignored.

  • 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). When the type is "shift", this is the value added to the item location (delta dot) as to create a uniform shift (DIF) for the group.

  • group (string). The group found in ⁠groups that should be perturbed. note that if ⁠groups⁠is not used in call to⁠genResponses' than this value is ignored and all cases' responses are perturbed.

Value

A matrix, n cases by i items, of scored item responses.

See Also

simplef(), browseVignettes("conquestr")

Examples

  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)

[Package conquestr version 1.3.4 Index]