itemCategoryRangeConstraint: Create item category constraints with minimum and maximum.

View source: R/itemCategoryMinMaxConstraint.R

itemCategoryRangeConstraintR Documentation

Create item category constraints with minimum and maximum.

Description

itemCategoriesRange, itemCategoriesMin, and itemCategoriesMax create constraints related to item categories/groupings (as represented by itemCategories). That is, the created constraints assure that the number of items of each category per test form is either smaller or equal than the specified max, greater than or equal to min or both range.

Usage

itemCategoryRangeConstraint(
  nForms,
  itemCategories,
  range,
  whichForms = seq_len(nForms),
  info_text = NULL,
  itemIDs = names(itemCategories)
)

itemCategoryMinConstraint(
  nForms,
  itemCategories,
  min,
  whichForms = seq_len(nForms),
  info_text = NULL,
  itemIDs = names(itemCategories)
)

itemCategoryMaxConstraint(
  nForms,
  itemCategories,
  max,
  whichForms = seq_len(nForms),
  info_text = NULL,
  itemIDs = names(itemCategories)
)

itemCategoryDeviationConstraint(
  nForms,
  itemCategories,
  targetValues,
  allowedDeviation,
  relative = FALSE,
  whichForms = seq_len(nForms),
  info_text = NULL,
  itemIDs = names(itemCategories)
)

Arguments

nForms

Number of forms to be created.

itemCategories

a factor representing the categories/grouping of the items

range

a matrix with two columns representing the the minimal and the maximum frequency of the items from each level/category itemCategories

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 "info"-attribute of the resulting constraint-object.

itemIDs

a character vector of item IDs in correct ordering, or NULL.

min

the minimal sum of the itemValues per test form

max

the minimal sum of the itemValues per test form

targetValues

an integer vector representing the target number per category. The order of the target values should correspond with the order of the levels of the factor in itemCategory.

allowedDeviation

the maximum allowed deviation from the targetValue

relative

a logical expressing whether or not the allowedDeviation should be interpreted as a proportion of the targetValue

Details

itemCategoriesDeviation also constrains the minimal and the maximal value of the number of items of each category per test form, but based on chosen targetValues, and maximal allowed deviations (i.e., allowedDeviation) from those targetValues.

Value

A sparse matrix.

Functions

  • itemCategoryMinConstraint(): constrain minimum value

  • itemCategoryMaxConstraint(): constrain maximum value

  • itemCategoryDeviationConstraint(): constrain the distance form the targetValues

Examples

## constraints to make sure that there are at least 2 and maximally 4
##  items of each item type in each test form
nItems <- 30
item_type <- factor(sample(1:3, size = nItems, replace = TRUE))
itemCategoryRangeConstraint(2, item_type, range = cbind(min = rep(2, 3), max = rep(4, 3)))

## or alternatively
itemCategoryDeviationConstraint(2, item_type,
targetValues = rep(3, 3),
allowedDeviation = rep(4, 3))


eatATA documentation built on Nov. 28, 2022, 5:14 p.m.