get.data.from.response: Convert an Integer Response (Pattern-Index) Matrix to FC Data...

View source: R/tools-data.R

get.data.from.responseR Documentation

Convert an Integer Response (Pattern-Index) Matrix to FC Data Strings

Description

Converts an integer matrix of pattern indices back to human-readable forced-choice data strings. This is the generic converter used by FCGGUM, FCMIRT, and FCGDINA where each column of the response matrix is an index into the block's observed permutation-pattern list.

Usage

get.data.from.response(response, block.items, fc.type = "RANK")

Arguments

response

An N \times B integer matrix of pattern indices. Each entry is an integer between 1 and the number of observed patterns for that block.

block.items

A list of length B giving the global item indices in each forced-choice block.

fc.type

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

Value

A data frame with N rows and B columns. Column names are "block.1", ..., "block.B". Cell values are character strings: full rankings ("2>5>8") for "RANK", "best>worst" pairs for "MOLE", and single integers for "PICK".

Pattern Generation and Numbering

For a block with K items, the set of possible response patterns depends on the forced-choice type:

RANK

All K! full permutations of the K items are generated. The patterns are listed in lexicographic order of the within-block item positions. For example, a 3-item block with items c(2,5,8) produces 3! = 6 patterns: (2,5,8), (2,8,5), (5,2,8), (5,8,2), (8,2,5), (8,5,2). Pattern index 1 means the first pattern was observed.

MOLE

For a K-item block, K(K-1) most-least observation patterns are possible: K choices for the most preferred item times K-1 choices for the least preferred item. Pattern (a,b) means item a was most preferred and item b was least preferred.

PICK

For a K-item block, exactly K patterns exist: one for each possible most-preferred item.

In all cases the pattern index (an integer from 1 to the number of observed patterns) is the row number in the matrix returned by the internal permutation helper for that block. The same deterministic pattern construction is exposed by generate_fc_permutation_patterns.

This format is a compact block-level encoding. One response column equals one forced-choice block, even when the block contains more than two items. This is the representation expected by the generic forced-choice model families FCGGUM, FCMIRT, and FCGDINA. It should not be confused with the TIRT pairwise format, where one block usually expands to several pair columns.

See Also

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

generate_fc_permutation_patterns for pattern generation.

get.data.from.response.TIRT for the TIRT-specific converter.

Examples

# 2 persons, 2 RANK blocks.
items <- list(1:2, 3:5)
resp <- cbind(c(1, 2), c(1, 6))
get.data.from.response(resp, items, fc.type = "RANK")

# Mixed block formats: first block is most-least, second block is pick.
mixed.items <- list(1:3, 4:6)
mixed.resp <- cbind(c(1, 6), c(1, 3))
get.data.from.response(
  mixed.resp, mixed.items, fc.type = c("MOLE", "PICK")
)

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