| get.response.from.data.FCDCM | R Documentation |
Parses FCDCM preference strings ("a>b" / "b>a") into a
0/1 binary response matrix. Each block compares exactly two items.
get.response.from.data.FCDCM(data, block.items)
data |
An |
block.items |
A list of length |
For each block, only two strings are valid: "a>b" and "b>a",
where a = block.items[[b]][1] and b = block.items[[b]][2].
Leading and trailing whitespace is ignored. Missing values or strings that
do not match the block-specific item pair produce an error, because FCDCM
fitting requires a complete binary response matrix.
If block.items was obtained from
get.block.items.from.data.FCDCM, the pair is sorted in
ascending order. In that common workflow, response value 1 means the
smaller item index was preferred and response value 0 means the larger item
index was preferred.
A named list with component response, an N \times B
integer matrix coded 0/1.
The output uses 0/1 coding: 1 indicates preference for the
first-named item in block.items[[b]]; 0 indicates preference
for the second-named item. This coding is the native format expected
by the FCDCM model estimation functions.
get.data.from.response.FCDCM for the reverse conversion.
get.response.from.data for the generic multi-item
converter.
items <- list(c(1L, 3L), c(2L, 4L))
dat <- data.frame(
b1 = c("1>3", "3>1", "1>3"),
b2 = c("2>4", "2>4", "4>2"),
stringsAsFactors = FALSE
)
get.response.from.data.FCDCM(dat, items)
get.data.from.response.FCDCM(
get.response.from.data.FCDCM(dat, items)$response, items
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.