ChooseItems: Select items to maximise the sum of sum particular variable...

View source: R/ChooseItems.R

ChooseItemsR Documentation

Select items to maximise the sum of sum particular variable whilst meeting other constraints

Description

This functions provides the basis on which the item selection App works.

Usage

ChooseItems(
  idata,
  maxvar,
  constrvars = NULL,
  constrmins = NULL,
  constrmaxs = NULL
)

Arguments

idata

A data frame containing information about all the items.

maxvar

A character string defining the variable for which the sum will be maximised by the choice of items.

constrvars

A character vector denoting the variable on which other contraints may be placed.

constrmins

A numeric vector of the minima that the sums of the "constrvars" must add up to. Must be same length as "constrvars".

constrmaxs

A numeric vector of the maxima that the sums of the "constrvars" must add up to. Must be same length as "constrvars".

Value

A vector denoting the indices of the rows of the data frame that were selected.

Examples

#summary information for 11 items worth 20 marks
item.summary.data=data.frame(
	item=1:11
	,Max=c(1,1,1,1,1,2,2,2,2,2,5)
	,Mean=c(0.02,0.23,0.61,0.65,0.56
		,1.34,1.44,1.2,1.07,0.32,3.67)
	,R_rest=c(0.14,0.46,0.59,0.63,0.42
		,0.55,0.53,0.68,0.72,0.49,0.49)
	)
#select an optimal 8 mark test (max R_rest per mark)
#with mean score between 5 and 6 marks)

choice=ChooseItems(item.summary.data,"R_rest"
	,constrvars = c("Max","Mean")
	,constrmins = c(8,5)
	,constrmaxs = c(8,6))
item.summary.data[choice,]
#check choices satisfy constraints
apply(item.summary.data[choice,],2,sum)

CambridgeAssessmentResearch/unimirt documentation built on June 10, 2025, 6:03 a.m.