| get.response.from.data.TIRT | R Documentation |
Parses human-readable forced-choice data strings (full rankings, most-least choices, or best-only picks) into the Thurstonian IRT pairwise binary response format. Each unordered item pair within a block receives a 1/0 outcome indicating which item was preferred.
get.response.from.data.TIRT(data, block.items, fc.type = NULL)
data |
An |
block.items |
A list of length |
fc.type |
Character vector of length |
This function expands each block column in data into one or more
pairwise response columns. Pair columns are grouped by block in the same
order as block.items. Within a pair column, the coding is always
1 if the first item in the pair is preferred, and 0 if the second item is
preferred.
Item labels must match the values supplied in block.items; they do
not need to be consecutive. For example, if
block.items = list(c(2, 7), c(10, 20, 30)), the second block can
contain "10>20>30", "30>10", or "20", depending on
fc.type.
A list with two components:
An N \times P integer matrix of pairwise
binary outcomes (1/0). For block b, the number of contributed
columns is K_b(K_b-1)/2 for RANK, 2K_b - 3 for MOLE, and
K_b - 1 for PICK.
A list of length N, each element being
a list of length B of integer pair-definition matrices.
Required as input for
get.data.from.response.TIRT.
For a block with K items, the number of pair columns depends on
fc.type: K(K-1)/2 for "RANK", 2K - 3 for
"MOLE", and K - 1 for "PICK". For each retained pair:
RANK: the item ranked earlier in the ordering is
preferred. For block.items[[b]] = 3:5, pair order is
(3,4), (3,5), (4,5). The string
"3>4>5" therefore produces pairwise responses
1, 1, 1.
MOLE: only the most- and least-preferred items are
identified (e.g. "3>2" in a 3-item block). The
remaining items are treated as tied in the middle, producing
preference relations consistent with the partial ordering.
PICK: only the most-preferred item is identified
(e.g. "3" in a 3-item block). All other items are
treated as equally less preferred.
The pairs.value component records the actual pair matrices used for
each person and block. It is essential for converting MOLE/PICK responses
back to data, because the retained pair set can differ across
persons.
get.data.from.response.TIRT for the reverse conversion.
get.response.from.data for the generic (non-TIRT)
converter used by FCGGUM and FCMIRT.
# 2 persons, 2 RANK blocks.
dat <- data.frame(
block.1 = c("1>2", "2>1"),
block.2 = c("3>4>5", "5>4>3"),
stringsAsFactors = FALSE
)
items <- list(1:2, 3:5)
result <- get.response.from.data.TIRT(dat, items, fc.type = "RANK")
result$response
result$pairs.value[[1]]
get.data.from.response.TIRT(
result$response, items, fc.type = "RANK",
pairs.value = result$pairs.value
)
# Mixed partial-response blocks.
dat.partial <- data.frame(
mole = c("1>3", "2>1"),
pick = c("4", "5"),
stringsAsFactors = FALSE
)
items.partial <- list(1:3, 4:6)
partial <- get.response.from.data.TIRT(
dat.partial, items.partial, fc.type = c("MOLE", "PICK")
)
partial$response
get.data.from.response.TIRT(
partial$response, items.partial, fc.type = c("MOLE", "PICK"),
pairs.value = partial$pairs.value
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.