Score an MCQ (27- or 21-item)
Usage
score_mcq(
dat = dat,
items = 27,
impute_method = "none",
round = 6,
random = FALSE,
trans = "none",
return_data = FALSE,
verbose = FALSE
)Arguments
- dat
Dataframe (longform) with subjectid, questionid, and response (0 for SIR/SS and 1 for LDR/LL)
- items
Number of MCQ items: 27 (Kirby, Petry, & Bickel, 1999) or 21 (Kirby & Marakovic, 1996). Default is 27.
- impute_method
One of: "none", "ggm", "GGM", "inn", "INN"
- round
Numeric specifying number of decimal places (passed to
base::round())- random
Boolean whether to insert a random draw (0 or 1) for NAs. Default is FALSE
- trans
Transformation to apply to k values: "none", "log", or "ln". Default is "none"
- return_data
Boolean whether to return the original data and new imputed responses. Default is FALSE.
- verbose
Boolean whether to print subject and question ids pertaining to missing data. Default is FALSE.
Value
If return_data = FALSE (default), a summary data frame with one
row per subject. If return_data = TRUE, a list with results (that
summary data frame) and data (the input data plus a newresponse
column reflecting any imputation).
Details
Each subject's data must satisfy a strict contract: exactly one
row per canonical question id (items of them; no duplicates, no unknown
ids, none missing) and responses coded 0, 1, or NA (numeric, logical, or
character/factor values that coerce to 0/1). Malformed input errors
rather than silently mis-scoring. Contrast with mcq_to_choice()'s
lenient, ragged contract, which accepts partial per-subject coverage.
Ladder edges follow the Kaplan et al. (2014) Excel scorers. A switch point between two items scores the geometric mean of their k values, and larger-later on every item gives the first item's k. Smaller-sooner on every item follows each instrument's workbook, and the two workbooks differ: on the overall (all-item) ladder the 27-item scorer takes the geometric mean of the last item's k and the edge 0.25 (0.2494), while the 21-item scorer assigns the edge 0.1333 itself. Either way the value is a convention: those responses only show that k exceeds the steepest item's k. The small / medium / large magnitude ladders repeat their own last k (21-item: 0.1333 / 0.1292 / 0.131). The 21-item ladder keeps the published item order within each k rank, which is not strictly ascending in k; it must not be re-sorted.
Examples
score_mcq(mcq27, items = 27)
#> subjectid overall_k small_k medium_k large_k geomean_k overall_consistency
#> 1 1 0.065212 0.025565 0.063690 0.064947 0.047289 0.962963
#> 2 2 0.000399 0.000633 0.001589 0.000251 0.000632 0.962963
#> small_consistency medium_consistency large_consistency composite_consistency
#> 1 1 1 1 1
#> 2 1 1 1 1
#> overall_proportion small_proportion medium_proportion large_proportion
#> 1 0.259259 0.333333 0.222222 0.222222
#> 2 0.777778 0.777778 0.666667 0.888889
#> impute_method
#> 1 none
#> 2 none
dat21 <- data.frame(subjectid = 1, questionid = 1:21, response = 1)
score_mcq(dat21, items = 21)
#> subjectid overall_k small_k medium_k large_k geomean_k overall_consistency
#> 1 1 7e-04 7e-04 7e-04 7e-04 7e-04 1
#> small_consistency medium_consistency large_consistency composite_consistency
#> 1 1 1 1 1
#> overall_proportion small_proportion medium_proportion large_proportion
#> 1 1 1 1 1
#> impute_method
#> 1 none
