easyRaschBayes provides functions to reproduce classic Rasch analysis features using Bayesian item response theory (IRT) models fitted with brms. It supports both dichotomous Rasch models and polytomous partial credit models, and exposes the full posterior distribution for all output.
For more materials on Rasch analysis, see the vignette for my (frequentist) package easyRasch.
Installation
Install the stable version from CRAN:
install.packages("easyRaschBayes")Or install the development version from GitHub:
install.packages("remotes") # if you don't have `remotes` installed
remotes::install_github("pgmj/easyRaschBayes")Main functions
| Function | Description |
|---|---|
infit_statistic() |
Conditional infit / outfit statistics |
item_restscore_statistic() |
Item–rest score associations with Goodman & Kruskal’s gamma |
plot_residual_pca() |
Residual PCA contrast plot for dimensionality assessment |
q3_statistic() |
Yen’s Q3 residual correlations for local dependence evaluation |
plot_ipf() |
Item category probability function curves |
plot_targeting() |
Person-item map (Wright map) |
dif_statistic() |
Differential Item Functioning (DIF) analysis |
fit_statistic_pcm() |
Posterior predictive item fit for polytomous models |
fit_statistic_rm() |
Posterior predictive item fit for dichotomous models |
RMUreliability() |
Reliability via Relative Measurement Uncertainty (RMU) |
Usage
library(brms)
library(easyRaschBayes)
# Fit a Bayesian Rasch model (dichotomous)
fit <- brm(
response ~ 1 + (1 | item) + (1 | id),
data = my_data,
family = bernoulli(),
chains = 4, cores = 4
)
# Conditional item infit
infit <- infit_statistic(fit)
infit_post(infit)
# Local dependence with Yen's Q3
q3_results <- q3_statistic(fit)
q3_post(q3_results)
# Response category functioning
plot_ipf(fit)
# Person-item map
plot_targeting(fit)References
Bürkner, P.-C. (2020). Analysing Standard Progressive Matrices (SPM-LS) with Bayesian Item Response Models. Journal of Intelligence, 8(1). doi:10.3390/jintelligence8010005
Bürkner, P.-C. (2021). Bayesian Item Response Modeling in R with brms and Stan. Journal of Statistical Software, 100, 1–54. https://doi.org/10.18637/jss.v100.i05
Credits
This started as a side project to update the code to assess item fit included in Bürkner (2020). With the help of Claude Opus 4.6 things expanded to try to reproduce core Rasch analysis steps. Most of the code in this package is produced by the LLM.
Magnus Johansson is a licensed psychologist with a PhD in behavior analysis. He works as a research specialist at Karolinska Institutet, Department of Clinical Neuroscience, Center for Psychiatry Research.
- ORCID: 0000-0003-1669-592X
- Bluesky: @pgmj.bsky.social
- Mastodon: @pgmj@scicomm.xyz