8  Using the performance package for item discrimination

Rather than using our own home made functions, we can use the performance package to calculate item discrimination. This is a package that is designed for psychometrics, and has a number of useful functions for calculating item statistics.

library(performance)
library(tidyverse)

8.1 Dichotomous items

# load in the dataset
responses <- read_csv('data/responses.csv')
# select the columns we want
responses <- responses %>% select(contains('_score')) 
# item stats
item_stats <- performance::item_reliability(responses)
knitr::kable(item_stats)
term alpha_if_deleted item_discrimination
Q1_score 0.808 0.252
Q2_score 0.807 0.294
Q3_score 0.801 0.398
Q4_score 0.808 0.264
Q5_score 0.807 0.284
Q6_score 0.792 0.539
Q7_score 0.796 0.476
Q8_score 0.793 0.533
Q9_score 0.794 0.515
Q10_score 0.802 0.380
Q11_score 0.804 0.338
Q12_score 0.796 0.486
Q13_score 0.807 0.305
Q14_score 0.800 0.410
Q15_score 0.802 0.391
Q16_score 0.797 0.462
Q17_score 0.807 0.302
Q18_score 0.812 0.224
Q19_score 0.796 0.496
Q20_score 0.814 0.196

8.2 Polytomous items

# load in the dataset
responses <- read_csv('data/pc-data.csv')
# drop the first six columns
resp <- responses %>% 
  select(-c(1:6))
# choose the columns that start with C1_
resp_c1 <- resp %>% 
  select(starts_with('C1_'))
# load in the dataset
# get the item stats
poly_item_stats <- performance::item_reliability(resp_c1)
knitr::kable(poly_item_stats)
term alpha_if_deleted item_discrimination
C1_1ai 0.850 0.147
C1_1aii 0.848 0.296
C1_1bi 0.851 0.105
C1_1bii 0.848 0.276
C1_1biii 0.846 0.355
C1_1biv 0.847 0.396
C1_1ci 0.846 0.370
C1_1cii 0.842 0.479
C1_1di 0.848 0.284
C1_1dii 0.846 0.364
C1_1e 0.839 0.543
C1_1eSPaG 0.845 0.433
C1_2ai 0.845 0.375
C1_2aii 0.848 0.273
C1_2bi 0.850 0.135
C1_2bii 0.848 0.291
C1_2biii 0.849 0.254
C1_2biv 0.843 0.455
C1_2bv 0.843 0.463
C1_2c 0.837 0.606
C1_2d 0.841 0.506
C1_3ai 0.840 0.536
C1_3aii 0.848 0.291
C1_3aiii 0.844 0.408
C1_3bi 0.850 0.117
C1_3bii 0.843 0.437
C1_3ci 0.845 0.384
C1_3cii 0.838 0.563
C1_3d 0.841 0.503