irtc_results: Machine-Readable Results with a Stable Schema

View source: R/irtc_results.R

irtc_resultsR Documentation

Machine-Readable Results with a Stable Schema

Description

Extracts fitted-model results as tidy data frames with a stable, documented schema aimed at automated callers (pipelines, AI agents). Column names are fixed English snake_case identifiers and never depend on the language option. irtc_json exports the same content as JSON (requires the optional jsonlite package).

Schema v1.1 components: model_info (one row: schema and package version, model, sizes, deviance, AIC/BIC, EAP reliability, iterations, and dimension_names when a Q matrix was supplied), items (per item: parameters, classical statistics, fit, quality rating and bilingual reasons/advice, plus a status column and, for polytomous items, semantic step difficulties and rare-category annotations), persons (per person: ID, number answered, raw score, EAP, SE, percentile, T score; ability/SE headers use the Q dimension names when available), cleaning_log and check_issues (present when the model was fitted via irtc). Schema 1.1 is additive over 1.0: existing column names and meanings are unchanged. Items declared in the Q matrix but not estimated keep a row with status "dropped_no_response" or "declared_not_estimated". See the package file inst/llms.txt for the full schema reference.

Usage

irtc_results(mod, resp = NULL)

irtc_json(mod, file = NULL, resp = NULL, pretty = TRUE)

## S3 method for class 'irtc_results'
print(x, lang = irtc_lang(), ...)

Arguments

mod

A fitted irtc model object; irtc_json also accepts an irtc_results object.

resp

The response data; only needed when the model object does not store it (streaming engine).

file

Optional path; when given, the JSON is written there (UTF-8) and the path is returned invisibly.

pretty

Logical: pretty-print the JSON?

x

An irtc_results object.

lang

Output language, "zh" or "en".

...

Ignored.

Value

irtc_results returns an object of class irtc_results, a list of data frames as described above. irtc_json returns a JSON string, or invisibly the file path when file is given.

See Also

irtc, irtc_excel

Examples

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))
}))
mod <- irtc(resp, model = "1PL", verbose = FALSE)

res <- irtc_results(mod)
res$model_info
head(res$items)

if (requireNamespace("jsonlite", quietly = TRUE)) {
    json <- irtc_json(mod)
    substr(json, 1, 80)
}

IRTC documentation built on July 24, 2026, 5:07 p.m.