1 Packages used

library(readxl)  # to read Excel file
library(psych)  # for PCA
library(eRm)  # for this Rasch analysis
## 
## Attaching package: 'eRm'
## The following object is masked from 'package:psych':
## 
##     sim.rasch
library(TAM)  # for reliability
## Loading required package: CDM
## Loading required package: mvtnorm
## **********************************
## ** CDM 8.2-6 (2022-08-25 15:43:23)       
## ** Cognitive Diagnostic Models  **
## **********************************
## * TAM 4.2-21 (2024-02-19 18:52:08)

2 Data

2.1 Original data

response_raw = read_xls("data_10.xls", sheet = 1)[-1,] |> as.data.frame()
key = read_xls("data_10.xls", sheet = 1)[1,] |> as.character()
head(response_raw)  # not well prepared yet for analysis!

2.2 Recoded data

Correct = 1, Incorrect = 0

response = response_raw
for (i in 2:ncol(response)) {
  response[,i] = ifelse(response_raw[,i] == rep(key[i],nrow(response_raw)), 1, 0)
}
head(response)
<