| forced_choice_data_conversion | R Documentation |
Documents the three data objects used by the forced-choice conversion
helpers: human-readable data, block definitions
block.items, and model-ready response matrices. This
overview is intended as the starting point before using
get.response.from.data,
get.data.from.response, the TIRT-specific converters, or
the FCDCM-specific converters.
The package uses two layers of forced-choice representation:
dataAn N \times B matrix or data frame that is easy
to read and edit. Rows are persons and columns are forced-choice
blocks. A cell records the observed ordering with item labels separated
by ">". For example, "3>4>5" means item 3 was ranked
above item 4, which was ranked above item 5.
block.itemsA list of length B. Element b
gives the item labels appearing in column b of data. This
object is the bridge between column order in the data file and item rows
in model parameter matrices such as Q.matrix.
responseThe compact numeric representation consumed by
model fitting code. Its meaning depends on the model family. For
FCGGUM, FCMIRT, and FCGDINA, response is an N \times B
matrix of 1-based pattern indices. For TIRT, response is an
N \times P matrix of pairwise binary outcomes. For FCDCM,
response is an N \times B binary matrix for two-item
blocks.
Use
get.response.from.data to convert character strings to
pattern indices, and get.data.from.response for the
inverse conversion.
Use get.response.from.data.TIRT and
get.data.from.response.TIRT. TIRT expands each block to
pairwise comparisons, so its response columns are pairs rather
than block-level pattern numbers.
Use get.response.from.data.FCDCM and
get.data.from.response.FCDCM. Each block has exactly two
statements, so response = 1 means the first statement in
block.items[[b]] was preferred and response = 0 means the
second statement was preferred.
block.itemsUse
get.block.items.from.data for generic multi-item
forced-choice data and get.block.items.from.data.FCDCM
for FCDCM pair data. Recovery is only possible for item labels that
actually appear in the observed strings.
The bth element of block.items always corresponds to
the bth column of data or response.
fc.type = "RANK" expects a complete ranking such as
"3>4>5" for a three-item block.
fc.type = "MOLE" expects a most-least string such as
"3>5": item 3 is most preferred and item 5 is least preferred.
fc.type = "PICK" expects a single most-preferred item such
as "3".
Generic FC pattern-index responses are 1-based. They are row
numbers in the deterministic pattern matrix generated internally; see
generate_fc_permutation_patterns for the public pattern
generator.
TIRT data should use consecutive item labels across blocks, for
example list(1:2, 3:5, 6:8). This is the format returned by
sim.data.TIRT and expected by the TIRT conversion
routines.
get.block.items.from.data,
get.response.from.data,
get.data.from.response,
get.response.from.data.TIRT,
get.data.from.response.TIRT,
get.response.from.data.FCDCM,
get.data.from.response.FCDCM
# Generic FC conversion: response is a block-level pattern index.
block.items <- list(1:2, 3:5)
dat <- data.frame(
block.1 = c("1>2", "2>1"),
block.2 = c("3>4>5", "5>4>3"),
stringsAsFactors = FALSE
)
resp <- get.response.from.data(dat, block.items, fc.type = "RANK")
resp
get.data.from.response(resp, block.items, fc.type = "RANK")
# TIRT conversion: response is pairwise 0/1 data.
tirt <- get.response.from.data.TIRT(dat, block.items, fc.type = "RANK")
tirt$response
get.data.from.response.TIRT(
tirt$response, block.items, fc.type = "RANK",
pairs.value = tirt$pairs.value
)
# FCDCM conversion: response is binary within each two-item block.
fcdcm.items <- list(c(1L, 3L), c(2L, 4L))
fcdcm.dat <- data.frame(
block.1 = c("1>3", "3>1"),
block.2 = c("2>4", "4>2"),
stringsAsFactors = FALSE
)
fcdcm.resp <- get.response.from.data.FCDCM(fcdcm.dat, fcdcm.items)
fcdcm.resp$response
get.data.from.response.FCDCM(fcdcm.resp$response, fcdcm.items)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.