itemExclusionConstraint {eatATA} | R Documentation |
Create item inclusion or exclusion constraints.
Description
Create constraints that prohibit that item pairs occur in the same test forms (exclusions) or force item pairs to be in the same test forms (inclusions).
Usage
itemExclusionConstraint(
nForms,
itemTuples,
itemIDs,
whichForms = seq_len(nForms),
info_text = NULL
)
itemInclusionConstraint(
nForms,
itemTuples,
itemIDs,
whichForms = seq_len(nForms),
info_text = NULL
)
Arguments
nForms |
Number of forms to be created. |
itemTuples |
|
itemIDs |
Character vector of item IDs in correct ordering. |
whichForms |
An integer vector indicating which test forms should be constrained. Defaults to all the test forms. |
info_text |
a character string of length 1, to be used in the |
Details
Item tuples can, for example, be created by the function itemTuples
.
Value
An object of class "constraint"
.
Functions
-
itemExclusionConstraint()
: item pair exclusion constraints -
itemInclusionConstraint()
: item pair inclusion constraints
Examples
## Simple Exclusion Example
# item-IDs
IDs <- c("item1", "item2", "item3", "item4")
# exclusion tuples: Item 1 can not be in the test form as item 2 and 3
exTuples <- data.frame(v1 = c("item1", "item1"), v2 = c("item2", "item3"),
stringsAsFactors = FALSE)
# inclusion tuples: Items 2 and 3 have to be in the same test form
inTuples <- data.frame(v1 = c("item2"), v2 = c("item3"),
stringsAsFactors = FALSE)
# create constraints
itemExclusionConstraint(nForms = 2, itemTuples = exTuples, itemIDs = IDs)
itemInclusionConstraint(nForms = 2, itemTuples = inTuples, itemIDs = IDs)
########
## Full workflow for exclusions using itemTuples
# Example data.frame
items <- data.frame(ID = c("item1", "item2", "item3", "item4"),
infoCol = c("item2, item3", NA, NA, NA))
# Create tuples
exTuples2 <- itemTuples(items = items, idCol = "ID", infoCol = "infoCol",
sepPattern = ", ")
## Create constraints
itemExclusionConstraint(nForms = 2, itemTuples = exTuples2, itemIDs = IDs)