Performs distractor analysis for each item and optional number of groups.
DistractorAnalysis(data, key, p.table = FALSE, num.groups = 3, matching = NULL,
match.discrete = FALSE, cut.points)
character: data matrix or data frame. See Details.
character: answer key for the items.
logical: should the function return the proportions. If FALSE
(default)
the counts are returned.
numeric: number of groups to that should be respondents splitted.
numeric: numeric vector. If not provided, total score is calculated and distractor analysis is performed based on it.
logical: is matching
discrete? Default value is FALSE
. See details.
numeric: numeric vector specifying cut points of matching
. See 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.
# 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