get.block.items.from.data.FCDCM: Extract Block Items from FCDCM Data

View source: R/tools-data.R

get.block.items.from.data.FCDCMR Documentation

Extract Block Items from FCDCM Data

Description

Recovers the two-item composition of each FCDCM block from a character data matrix of "a>b" / "b>a" preference strings. Because every FCDCM block always compares exactly two statements, this function only needs to inspect the first non-missing row of each column.

Usage

get.block.items.from.data.FCDCM(data)

Arguments

data

An N \times B character matrix (or data frame) of binary-preference strings. Each cell must be of the form "a>b" or "b>a" where a and b are global statement indices. Missing values are skipped.

Details

The returned item pair is sorted in ascending order. For example, both "1>3" and "3>1" imply c(1L, 3L) for that block. This sorted pair is then the default coding direction used by get.response.from.data.FCDCM: response value 1 means the first element of the pair was preferred, and response value 0 means the second element was preferred.

This helper assumes the two compared statements are fixed within each column. If a column accidentally mixes different item pairs, only the first parseable non-missing cell determines the returned pair, so such data should be cleaned before conversion.

Value

A list of length B. Each element is a two-element integer vector c(a, b) with a < b.

See Also

get.block.items.from.data for the generic multi-item variant used by FCGGUM, FCMIRT, and TIRT.

get.response.from.data.FCDCM to convert FCDCM data strings to a 0/1 response matrix.

Examples

dat <- data.frame(
  b1 = c("1>3", "3>1", "1>3"),
  b2 = c("2>4", "2>4", "4>2"),
  stringsAsFactors = FALSE
)
get.block.items.from.data.FCDCM(dat)

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