get.response.from.data.TIRT: Convert TIRT Forced-Choice Data to Pairwise-Response Matrix

View source: R/tools-data.R

get.response.from.data.TIRTR Documentation

Convert TIRT Forced-Choice Data to Pairwise-Response Matrix

Description

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.

Usage

get.response.from.data.TIRT(data, block.items, fc.type = NULL)

Arguments

data

An N \times B character matrix or data frame of forced-choice responses. Each cell encodes the within-block item ordering using item labels from block.items separated by ">" (e.g. "3>1>2" for RANK, "3>2" for MOLE, "3" for PICK).

block.items

A list of length B giving the unique item labels in each forced-choice block.

fc.type

Character vector of length B (or a scalar recycled to all blocks): "RANK", "MOLE", or "PICK".

Details

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.

Value

A list with two components:

response

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.

pairs.value

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.

Pattern Naming and Pair Encoding

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.

See Also

get.data.from.response.TIRT for the reverse conversion.

get.response.from.data for the generic (non-TIRT) converter used by FCGGUM and FCMIRT.

Examples

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

ForceChoice documentation built on Sept. 13, 2026, 1:06 a.m.