| irtc | R Documentation |
Reads data from a file or R object, cleans it, optionally scores raw multiple-choice responses against an answer key, checks it, estimates the requested item response model and enriches the result with classical item statistics, item fit and plain-language quality ratings.
Designed for non-specialists and automated callers; professional users keep
full control because all additional arguments are passed unchanged to
irtc.mml (for "1PL", "PCM", "PCM2",
"RSM") or irtc.mml.2pl (for "2PL",
"GPCM").
irtc(data, model, key = NULL, rules = NULL, q = NULL,
on_mismatch = c("warn", "error"),
rare_categories = c("collapse", "prior"), id = NULL, weights = NULL,
sheet = 1, missing_codes = c(-9, -99, 99, 999), check = TRUE,
quality = TRUE, verbose = TRUE, ...)
data |
A file path ( |
model |
Required. One of |
key |
An optional answer key for raw responses: a named vector or
a key-file path (optionally with a partial-answer column); see
|
rules |
An optional partial-credit scoring table or a path to one;
see |
q |
An optional Q (item-by-dimension) matrix: a file path, data
frame, matrix, or an object from |
on_mismatch |
How to handle items that differ between the Q matrix
and the data; see |
rare_categories |
How to handle score categories nobody reached
(nobody fully correct / partially correct / wrong).
|
id |
An optional person identifier column (name or index); passed to
|
weights |
An optional sampling weight column (name or index); passed
to |
sheet |
Excel sheet to read (number or name). |
missing_codes |
Numeric values recoded to |
check |
Logical: stop with a structured error if
|
quality |
Logical: attach CTT statistics, item fit and quality ratings to the result? |
verbose |
Logical: print estimation progress? |
... |
Further arguments passed to |
Items without any observed responses or without variance are removed
before estimation (with a warning of class irtc_warning_estimation).
All errors raised by the usability layer are structured conditions with
fields code, reason and fix; see the package file
inst/llms.txt for the full list of codes.
The language of user-facing output is controlled by
options(irtc.lang = "zh") (default) or "en".
An object of class irtc (see irtc.mml) with an
additional list component usability containing model,
data_log (cleaning log), check (the
irtc_check_data result), removed_items,
ctt, itemfit and quality.
irtc_read, irtc_check_data,
plain_summary, irtc_excel,
irtc_report, irtc_results
set.seed(1)
theta <- rnorm(150)
resp <- as.data.frame(sapply(seq(-1, 1, length.out = 5), function(b) {
as.numeric(runif(150) < plogis(theta - b))
}))
colnames(resp) <- paste0("I", 1:5)
mod <- irtc(resp, model = "1PL", verbose = FALSE)
plain_summary(mod, lang = "en")
mod$usability$quality
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.