Learn R Programming

ShinyItemAnalysis (version 1.3.4)

plotDistractorAnalysis: Function for graphical representation of item distractor analysis

Description

Plots graphical representation of item distractor analysis with proportions and optional number of groups.

Usage

plotDistractorAnalysis(data, key, num.groups = 3, item = 1, item.name,
multiple.answers = TRUE, matching = NULL, match.discrete = FALSE, cut.points)

Arguments

data

character: data matrix or data frame. See Details.

key

character: answer key for the items.

num.groups

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

item

numeric: the number of item to be plotted.

item.name

character: the name of item.

multiple.answers

logical: should be all combinations plotted (default) or should be answers splitted into distractors. See Details.

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 graphical representation of DistractorAnalysis function. 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 proportions of respondents in each quantile are displayed 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.

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 it is not provided, matching need to be specified.

If multiple.answers = TRUE (default) all reported combinations of answers are plotted. If multiple.answers = FALSE all combinations are splitted into distractors and only these are then plotted with correct combination.

See Also

DistractorAnalysis, distractor.analysis

Examples

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

# distractor plot for items 48, 57 and 32 displaying distractors only
plotDistractorAnalysis(data, key, item = 48, multiple.answers = FALSE)
# correct answer B does not function well
plotDistractorAnalysis(data, key, item = 57, multiple.answers = FALSE)
# all options function well, thus the whole item discriminates well
plotDistractorAnalysis(data, key, item = 32, multiple.answers = FALSE)
# functions well, thus the whole item discriminates well
# }
# NOT RUN {
# distractor plot for items 48, 57 and 32 displaying all combinations
plotDistractorAnalysis(data, key, item = 48)
plotDistractorAnalysis(data, key, item = 57)
plotDistractorAnalysis(data, key, item = 32)

# distractor plot for item 57 with all combinations and 6 groups
plotDistractorAnalysis(data, key, item = 57, num.group = 6)

# distractor plot for item 57 using specified matching and key option
matching <- round(rowSums(dataBin), -1)
plotDistractorAnalysis(data, key, item = 57, matching = matching)
# distractor plot for item 57 using specified matching without key option
plotDistractorAnalysis(data, item = 57, matching = matching)

# distractor plot for item 57 using discrete matching
plotDistractorAnalysis(data, key, item = 57, matching = matching, match.discrete = T)

# distractor plot for item 57 using groups specified by cut.points
plotDistractorAnalysis(data, key, item = 57, cut.points = seq(10, 100, 10))
# }

Run the code above in your browser using DataLab