| get.block.items.from.data | R Documentation |
Infers the item composition of each forced-choice block from a character
data matrix. Each cell should encode the within-block item ordering
(e.g. "2>1>3" for a rank-3 block). The function parses all
non-missing cells per block and returns sorted, unique item indices.
This function is the recommended way to recover block.items when
only character-rank data are available. It works for all forced-choice
types ("RANK", "MOLE", "PICK") as long as every
item appears at least once across persons.
get.block.items.from.data(data)
data |
An |
The returned block.items list defines the block layout used by the
other converters. If data has B columns, the result has
B elements, and result element b belongs to data column
b. Item labels are treated as global item indices; they are not
recoded to local positions.
The function scans observed strings only. Therefore, for partial-response formats, it can only recover items that appear in the observed partial strings:
For "RANK", a complete ranking normally contains every item
in the block, so one valid row can be sufficient.
For "MOLE", only most- and least-preferred items appear in
each cell. An item that is never chosen as most or least cannot be
recovered from data alone.
For "PICK", only picked items appear. Items that are never
picked cannot be recovered from data alone.
In those partial-response cases, pass a complete user-defined
block.items list to the fitting or conversion function when the raw
data do not mention every item.
A list of length B. Each element is an integer vector of
global item indices appearing in that block, sorted in ascending order.
get.block.items.from.data.FCDCM for the FCDCM (binary-pair)
variant.
get.response.from.data to convert character data to an
integer pattern-index matrix.
# 3 persons, 2 blocks.
# Block 1 contains items 1 and 2; block 2 contains items 3, 4, and 5.
dat <- data.frame(
block.1 = c("1>2", "2>1", "1>2"),
block.2 = c("3>4>5", "5>4>3", "4>3>5"),
stringsAsFactors = FALSE
)
get.block.items.from.data(dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.