Learn R Programming

ShinyItemAnalysis (version 1.3.4)

DistractorAnalysis: Function for item distractor analysis

Description

Performs distractor analysis for each item and optional number of groups.

Usage

DistractorAnalysis(data, key, p.table = FALSE, num.groups = 3, matching = NULL,
match.discrete = FALSE, cut.points)

Arguments

data

character: data matrix or data frame. See Details.

key

character: answer key for the items.

p.table

logical: should the function return the proportions. If FALSE (default) the counts are returned.

num.groups

numeric: number of groups to that should be respondents splitted.

matching

numeric: numeric vector. If not provided, total score is calculated and distractor analysis is performed based on it.

match.discrete

logical: is matching discrete? Default value is FALSE. See details.

cut.points

numeric: numeric vector specifying cut points of matching. See details.

Details

This function is adapted version of distractor.analysis function from CTT package.

The data is a matrix or data frame whose rows represents unscored item response from a multiple-choice test and columns correspond to the items.

The key must be a vector of the same length as ncol(data).

In case, no matching is provided, the scores are calculated using the item data and key. The respondents are by default splitted into the num.groups-quantiles and the number (or proportion) of respondents in each quantile is reported with respect to their answers. In case that matching is discrete (match.discrete = TRUE), matching is splitted based on its unique levels. Other cut points can be specified via cut.points argument.

See Also

distractor.analysis

Examples

Run this code
# NOT RUN {
# loading 100-item medical admission test data
data(dataMedicaltest, dataMedicalkey)
data <- dataMedicaltest[, 1:100]
dataBin <- dataMedical[, 1:100]
key <- unlist(dataMedicalkey)

# distractor analysis for dataMedicaltest data set
DistractorAnalysis(data, key)
# }
# NOT RUN {
# distractor analysis for dataMedicaltest data set with proportions
DistractorAnalysis(data, key, p.table = T)

# distractor analysis for dataMedicaltest data set for 6 groups
DistractorAnalysis(data, key, num.group = 6)

# distractor analysis for dataMedicaltest using specified matching
matching <- round(rowSums(databin), -1)
DistractorAnalysis(data, key, matching = matching)

# distractor analysis for dataMedicaltest using discrete matching
DistractorAnalysis(data, key, matching = matching, match.discrete = T)

# distractor analysis for dataMedicaltest using groups specified by cut.points
DistractorAnalysis(data, key, cut.points = seq(10, 100, 10))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab