prepare_data: Prepare Data for IRT Analysis

View source: R/functions.R

prepare_dataR Documentation

Prepare Data for IRT Analysis

Description

Prepare Data for IRT Analysis

Usage

prepare_data(data)

Arguments

data

A data frame or matrix of binary responses (0 and 1).

Value

A list containing the following two components:

  • matrix: A numeric matrix of the original data, converted to numeric format and potentially reordered by total score.

  • total_score: A numeric vector representing the sum of correct responses (row sums) for each person, sorted in descending order if the original data was unsorted.

Examples

set.seed(123)
raw_data <- data.frame(
  item1 = c(1, 0, 1, 1),
  item2 = c(0, 0, 1, 1),
  item3 = c(1, 1, 1, 0)
)

prepared <- prepare_data(raw_data)

print(prepared$matrix)
print(prepared$total_score)


GLMBasedRaschEstimation documentation built on April 22, 2026, 9:08 a.m.