This document explains how to create constraints data forloadConstraints(). Automated test assembly in practice isoften desired to assemble a test so that its contents adhere to a testblueprint, which asserts various requirements the assembled test shouldsatisfy. As ofTestDesign version 1.1.0, constraints can beread in fromdata.frame objects or.csvspreadsheet files. The input data is expected to be in the followingstructure:
| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C1 | Number | Item | 30 | 30 | ||
| C2 | Number | Item | LEVEL == 3 | 10 | 10 | |
| C3 | Number | Item | LEVEL == 4 | 10 | 10 | |
| C4 | Number | Item | LEVEL == 5 | 10 | 10 | |
| C5 | Number | Item | STANDARD == 1 | 17 | 20 |
Constraints data must have seven columns, named asCONSTRAINT_ID,TYPE,WHAT,CONDITION,LB,UB,ONOFF on the first row. Beginning from the second row, eachrow must have corresponding values for each column. A convenient way forworking with constraints is to use a spreadsheet application(e.g. Excel) and work on the content from there.
Readers are also encouraged to tinker with example constraintsincluded in the package:
constraints_science_data (all discrete items)constraints_reading_data (set-based blueprint)constraints_fatigue_data (uses enemy items)constraints_bayes_data (uses word countconstraints)This section aims to provide context on why the constraints inputformat does not have a column for weights.
TheTestDesign package performs content balancing using theshadow-test approach (van der Linden & Reese, 1998). This means thatthe test will be assembled in a way that strictly satisfies allconstraints with no violations. The reader may be familiar with the useof weights in test blueprints for indicating which constraints should beprioritized. These constraint-wise weights are mainly needed whentraditional content balancing methods are used, where items are selectedone by one. When items are selected one by one, there is a fundamentallimitation that there is no guarantee that the resulting test willsatisfy all constraints. For this reason, weights are used assupplements to traditional content balancing to work around thislimitation, to guide the item selection process in a way that the numberof violated constraints is minimized.
Unlike with traditional content balancing methods, the shadow-testapproach operates without needing weights. This is because theshadow-test approach directly finds a combination of items thatsatisfies all constraints, and therefore has no need to prioritizecertain constraints to satisfy, as would be needed in traditionalcontent balancing methods that select items one by one.
This column specifies the identifier of each constraint. Charactervalues can be used as long as the values are unique.
This column specifies the type of constraint. Following values areexpected:Number,Order,Enemy,Include,Exclude,AllorNone.
Number specifies the constraint to be applied to thenumber of selected items (ifWHAT column isItem), or to the number of selected item sets (ifWHAT column isStimulus). For example, thefollowing row tells the solver to select a total of 30 items.| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C1 | Number | Item | 30 | 30 |
Sum specifies the constraint to be applied to the sumof attributes of selected items (ifWHAT column isItem), or of selected item sets (ifWHATcolumn isStimulus). For example, the following row tellsthe solver to keep the sum ofWORDS between 500–600.| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C2 | Sum | Item | WORDS | 500 | 600 |
Order specifies the selection to be made in ascendingorder. The following row tells the solver to select the items inascendingLEVEL, based on supplied attributes.| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C32 | Order | Item | LEVEL |
Enemy specifies the items (or item sets) matching thecondition to be treated as enemy items. To tell the solver to select atmost one of the two items:| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C33 | Enemy | Item | ID %in% c(“SC00001”, “SC00002”) |
Include specifies the items matching the condition tobe always included in selection. For example, the following row tellsthe solver to include itemsSC00003 andSC00004:| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C34 | Include | Item | ID %in% c(“SC00003”, “SC00004”) |
Exclude specifies the items matching the condition tobe always excluded from selection. The following row tells the solver toexclude items that matchPTBIS < 0.15, based on supplieditem attributes.| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C35 | Exclude | Item | PTBIS < 0.15 |
AllOrNone specifies the items matching the condition tobe either all included or all excluded. To tell the solver to eitherselect itemsSC00005 andSC00006 at the sametime or exclude them at the same time:| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C36 | AllOrNone | Item | ID %in% c(“SC00005”, “SC00006”) |
This column specifies the unit of assembly the constraint uses.Expected values areItem orStimulus.
This column specifies the condition of the constraint. An Rexpression returning logical values (TRUE orFALSE) is expected. The variables supplied in itemattributes can be used in the expression as variable names.
Some examples are:
"STANDARD %in% c(2, 4)" tells the solver to select whenSTANDARD is either 2 or 4."STANDARD %in% c(2, 4) & DOK >= 3" tells thesolver to select whenSTANDARD is either 2 or 4, and alsoDOK is at least 3.!is.na(FACIT) tells the solver to select whenFACIT is not empty.ForTYPE == SUM, using a variable name imposes theconstraint on the sum of the variable. The following row tells thesolver to keep the sum ofWORDS between 500–600.
| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C2 | Sum | Item | WORDS | 500 | 600 |
ForTYPE == SUM, constraints on conditional sums can beimposed by using a variable name, placing a comma, and then giving an Rexpression returning logical values. The following row tells the solverto keep the sum ofWORDS withinDOK == 1 itemsbetween 50–80.
| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C3 | Sum | Item | WORDS, DOK == 1 | 50 | 80 |
In set-based assembly,Per Stimulus can be used tospecify the number of items to select in each stimulus. For example, thefollowing row tells the solver to select 4 to 6 items per stimulus:
| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C3 | Number | Item | Per Stimulus | 4 | 6 |
These two columns specify lower and upper bounds on the number ofselected items. These must be specified whenTYPE isNumber, and otherwise must be left empty.
Some example rows are provided.
| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C1 | Number | Item | 12 | 12 |
DOK >= 2:| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C17 | Number | Item | DOK >= 2 | 15 | 30 |
Set this toOFF to turn off the constraint from beingapplied.ON or leaving it blank applies the constraint. Thefollowing example specifies the order constraint to be not applied.
| CONSTRAINT_ID | TYPE | WHAT | CONDITION | LB | UB | ONOFF |
|---|---|---|---|---|---|---|
| C18 | Order | Passage | CONTENT | OFF |
van der Linden W. J., Reese L. M. (1998). A model for optimalconstrained adaptive testing.Applied Psychological Measurement,22(3), 259-270.https://doi.org/10.1177/01466216980223006