easyRasch2 is an R package for Rasch measurement theory
analysis workflows. It is the successor to easyRasch,
offering a lightweight and consistent structure with proper namespacing
and minimal dependencies.
A central design choice is simulation-based critical values for various fit statistics. Rather than relying on rule-of-thumb cutoffs, most diagnostics are paired with a parametric-bootstrap function that generates an empirical null distribution from the fitted Rasch / PCM model and the observed sample.
The Get
Started link above contains a short introduction. For broader
Rasch-analysis tutorials, see the vignette
for the sibling package easyRasch.
eRm, psychotools, and iarm
for item parameters; Weighted Likelihood Estimation (WLE) for person
parameters; mirt (MML) only where CML alternatives do not
exist (e.g., Q3 residual correlations).knitr::kable() for tables
(Quarto-friendly), ggplot2 for figures, and
"dataframe" output options for downstream use.RM prefix
(e.g., RMlocdepQ3()).RMitemInfit() — conditional infit MSQRMitemInfitCutoff() +
RMitemInfitCutoffPlot() — simulation-based cutoffs and
plotRMitemInfitMI() + RMitemInfitCutoffMI() —
multiple-imputation variantsRMitemRestscore() — item-restscore with
Goodman-Kruskal’s gammaRMitemRestscoreBoot() — non-parametric bootstrap of
item-restscore fitRMitemICCPlot() - conditional item characteristic
curvesRMlocdepQ3() + RMlocdepQ3Cutoff() — Yen’s
Q3 residual correlationsRMlocdepGamma() + RMlocdepGammaCutoff() +
RMlocdepGammaPlot() — partial-gamma local dependenceRMdimResidualPCA() +
RMdimResidualPCACutoff() — PCA of standardized residuals,
with simulation-based first-contrast cutoff (Chou & Wang, 2010)RMdimMartinLof() +
RMdimMartinLofResiduals() — Martin-Löf LR test (Christensen
& Kreiner, 2007), supports polytomous dataRMdimCFACutoff() + RMdimCFAPlot() —
posterior-predictive CFA fit-index cutoffs under PCM unidimensionality
(via lavaan WLSMV)RMdifLR() — Andersen’s likelihood-ratio test
(eRm::LRtest)RMdifTree() — Rasch / partial-credit trees
(psychotree) with Mantel-Haenszel or partial-gamma effect
sizes per split, optional iterative purification, and
stablelearner-based stability assessmentRMdifGamma() + RMdifGammaCutoff() +
RMdifGammaPlot() — partial-gamma DIFRMitemICCPlot() - evaluates DIF across class
intervalsRMitemCatProb() for classic item probability function
trace plots.RMitemHierarchy() renders a plot sorting items based on
difficulty, showing item threshold locations and confidence
intervals.RMreliability() + RMUreliability() —
Cronbach’s α, PSI, empirical reliability, and Relative Measurement
Uncertainty from plausible valuesRMtargeting() — Wright-map style person-item targeting
plotRMscoreSE() — raw-score → logit transformation table
(WLE / EAP)RMplotTile() — response-distribution heatmap with
optional group facetingRMplotBar() & RMplotStackedbar()Install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("pgmj/easyRasch2")library(easyRasch2)
data("pcmdat2", package = "eRm")
options(mc.cores = 4)
set.seed(42)
# Conditional item infit with simulation-based cutoffs
simfit <- RMitemInfitCutoff(pcmdat2, iterations = 250)
RMitemInfit(pcmdat2, cutoff = simfit)
# Test of unidimensionality via posterior-predictive ordinal CFA
cfa_res <- RMdimCFACutoff(pcmdat2, iterations = 250)
cfa_res # kable: observed vs simulated cutoffs
RMdimCFAPlot(cfa_res) # histogram + observed diamond
# DIF analysis via Andersen's LR test
grp <- factor(sample(c("A", "B"), nrow(pcmdat2), replace = TRUE))
RMdifLR(pcmdat2, dif_var = grp)
# Rasch-tree DIF with effect-size classification on continuous +
# categorical covariates simultaneously
covs <- data.frame(
group = grp,
band = sample(c("low", "high"), nrow(pcmdat2), replace = TRUE)
)
RMdifTree(pcmdat2, covariates = covs)As mentioned earlier, this is based on my easyRasch
package, and I am using Claude to “transfer” functions to this more
properly formatted package. While it uses my earlier code, most of the
code in this package is produced by the LLM and bug fixed by me.
RMdifTree() adapts MIT-licensed code from Mirka
Henninger and Jan Radek’s raschtreeMH
and effecttree
packages for the effect-size and ETS-classification algorithms.
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.
GPL (>= 3)