term & (term, exam) :## [1] 149 34
eRm package uses : conditional maximum likelihood
(CML) estimation. Therefore it does not require the specification of the
latent trait distribution ( \(\theta\)
).
Above I fit a Rasch Model
Here we assume \(\sum_{i=1}^{34}b_i=0\) ; meaning, the sum of item difficulty is 0.
Typical item Difficulty
Easy Item Difficulty
Hard Item Difficulty
## [1] 1
item_difficulty <- cbind(-Rasch_CML$betapar, Rasch_CML$se.beta)
colnames(item_difficulty) <- c("est", "SE")
item_difficulty <- item_difficulty |> as.data.frame(); item_difficultydifficulty_CI <- cbind(-confint(Rasch_CML)[,2], -confint(Rasch_CML)[,1])
colnames(difficulty_CI) <- c("Low", "High")
difficulty_CI <- difficulty_CI |> as.data.frame(); difficulty_CIdifficulty <- cbind(difficulty_CI, est=item_difficulty[,1], item = names(Rasch_CML$betapar))
# summary(Rasch_CML)
# better method^difficulty |>
ggplot(aes(
x = est,
y = reorder(item, est),
xmin = Low,
xmax = High
)) +
geom_pointrange() +
geom_vline(
xintercept = 0,
linetype = "dashed"
) +
labs(
title = "Item Difficulty CI-95%",
x = "Item Difficulty",
y = "Item"
) +
theme_minimal()# set margin sizes
par(
mfrow = c(2, 1),
mar = c(3, 4, 2, 1)
)
hist(
item_difficulty$est,
main = "Item Difficulty Dist"
)
boxplot(
item_difficulty$est,
horizontal = TRUE
)As we can see difficulty is normally distributed
percent_correct <- S24MQ |>
summarize(
across(
everything(),
~ mean(.x, na.rm = TRUE) * 100
)
)
percent_correctpercent_correct_long <- percent_correct |>
pivot_longer(
cols = everything(),
names_to = "item",
values_to = "percent_correct"
)
difficulty_percent <- difficulty |>
mutate(
item = str_remove(item, "^beta ")
) |>
left_join(
percent_correct_long,
by = "item"
)difficulty_percent |>
ggplot(aes(
x = est,
y = percent_correct
)) +
geom_point() +
geom_text(
aes(label = item),
nudge_y = 2,
size = 3
) +
labs(
title = "Item Difficulty vs. Percent Correct",
x = "Item Difficulty",
y = "Percent Correct"
) +
theme_minimal()## [1] 0.9154302
about 92% of variation can be described via regressing
est and percent_correct