View source: R/itemValuesConstraint.R
itemValuesConstraint | R Documentation |
Create constraints related to an item parameter/value. That is, the created
constraints assure that the sum of the item values (itemValues
) per test form is either
(a) smaller than or equal to (operator = "<="
), (b) equal to
(operator = "="
), or (c) greater than or equal to (operator = ">="
)
the chosen targetValue
.
itemValuesConstraint(
nForms,
itemValues,
operator = c("<=", "=", ">="),
targetValue,
whichForms = seq_len(nForms),
info_text = NULL,
itemIDs = names(itemValues)
)
nForms |
Number of forms to be created. |
itemValues |
Item parameter/values for which the sum per test form should be constrained. |
operator |
A character indicating which operator should be used in the
constraints, with three possible values: |
targetValue |
the target test form value. |
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 |
itemIDs |
a character vector of item IDs in correct ordering, or NULL. |
When operator
is "<="
, the constraint can be mathematically formulated as:
\mjsdeqn\sum_i=1^I v_i \times x_if \leq t , \; \; \; for
\: f \in G,
where \mjseqnI refers to the number of items in the item pool, \mjseqnv_i is the
itemValue
for item \mjseqni and \mjseqnt is the targetValue
. Further, \mjseqnG
corresponds to whichForms
, so that the above inequality constraint
is repeated for every test form \mjseqnf in \mjseqnG. In addition, let \mjseqn\boldsymbolx
be a vector of binary decision variables with length \mjseqnI \times F, where \mjseqnF
is nForms
. The binary decision variables \mjseqnx_if are defined as:
\mjseqn\;\;\;\;\;\;\;\; | \mjseqnx_if = 1,\mjseqn\;\;\;\; | if item \mjseqni is assigned to form \mjseqnf, and |
\mjseqn\;\;\;\;\;\;\;\; | \mjseqnx_if = 0,\mjseqn\;\;\;\; | otherwise. |
An object of class "constraint"
.
## constraints to make sure that the sum of the item values (1:10) is between
## 4 and 6
combineConstraints(
itemValuesConstraint(2, 1:10, operator = ">=", targetValue = 4),
itemValuesConstraint(2, 1:10, operator = "<=", targetValue = 6)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.