DPMirt 0.2.0
DPMirt 0.2.0 is the overhaul release. It expands the package from the initial development release into a release-candidate implementation with a clearer model contract, richer posterior-draw metadata, broader diagnostics, updated vignettes, and a rebuilt pkgdown site.
Models
- Rasch, 2PL, and 3PL item response theory models.
- Parametric (Normal) and semiparametric (Dirichlet Process Mixture) latent trait priors.
- IRT and slope-intercept (SI) parameterizations for 2PL and 3PL.
- Three identification strategies:
constrained_item(Rasch default),constrained_ability, andunconstrainedwith post-hoc rescaling (2PL/3PL default). - 3PL models include item guessing parameters (
delta), with posterior summaries, rescaled draw extraction, and plots where applicable. - Some identification combinations are intentionally unavailable:
constrained_itemis rejected for 3PL models, andconstrained_abilityis rejected for DPM models.
Workflow
-
dpmirt()— all-in-one model fitting (spec → compile → sample → rescale). - Modular pipeline:
dpmirt_spec()→dpmirt_compile()→dpmirt_sample()→dpmirt_rescale(). -
dpmirt_resume()— continue sampling without recompilation while the compiled NIMBLE object is live in the current R session. Saved RDS objects cannot restore compiled pointers. -
sampler_configaccepts an advanced function hook for NIMBLE sampler customization. List-based sampler schemas are reserved. -
item_priorsis reserved; useNULLorlist()for DPMirt’s fixed item priors.
Posterior Summaries
- Three estimators via
dpmirt_estimates():- PM (Posterior Mean) — optimal individual-level MSE.
- CB (Constrained Bayes; Ghosh, 1992) — moment-matched to the posterior predictive distribution.
- GR (Triple-Goal; Shen & Louis, 1998) — simultaneous estimation, ranking, and distributional recovery.
-
dpmirt_draws()— extract posterior samples in matrix or long format. Current extraction is for rescaled draws only; raw draw extraction is reserved. -
dpmirt_loss()— evaluate MSEL, MSELR, KS, and custom loss metrics.
Diagnostics
-
dpmirt_fitobjects carryschema_version,chain_info,draw_index, andrun_historymetadata. -
dpmirt_diagnostics()— ESS, optional chain-aware R-hat, trace summaries, WAIC provenance, timing, and DPM cluster diagnostics. -
dpmirt_compare()— WAIC-based model comparison across fits, includingwaic_aggregationprovenance. -
dpmirt_dp_density()— posterior density estimation from the DP mixture. This can be computationally expensive because it reconstructs posterior DP measure samples through NIMBLE’s publicmodelValuesandgetSamplesDPmeasure()workflow. -
save_draws = FALSEandsave_pathare reserved; DPMirt currently returns in-memory draw-retaining fit objects.
Simulation
-
dpmirt_simulate()— generate IRT data with Rasch, 2PL, and 3PL response models. 3PL fallback simulation includes Beta-distributed guessing parameters (delta) and does not usetarget_rho. - IRTsimrel integration for Rasch/2PL reliability-targeted simulation via EQC calibration by default, with SAC calibration for MSEM targets; 3PL uses DPMirt’s internal fallback simulator.
Prior Elicitation
-
dpmirt_alpha_prior()— principled concentration-parameter selection via DPprior, with graceful fallback to Gamma(1, 3).
Visualization
- S3
plot()methods fordpmirt_fit,dpmirt_estimates, anddpmirt_simobjects. - 12 standalone ggplot2 functions:
dpmirt_plot_trace(),dpmirt_plot_density(),dpmirt_plot_caterpillar(),dpmirt_plot_items(),dpmirt_plot_icc(),dpmirt_plot_info(),dpmirt_plot_dp_density(),dpmirt_plot_clusters(),dpmirt_plot_wright_map(),dpmirt_plot_parameter_trace(),dpmirt_plot_density_compare(),dpmirt_plot_pp_check().
Documentation
- Eight vignettes covering quick start, models and workflow, posterior summaries, prior elicitation, simulation studies, mathematical foundations, and NIMBLE internals.
- Precomputed vignette fixtures follow an 11
.rdsfile compact fixture contract ininst/extdata, plus aninst/extdata/README.mdnote. Fit fixtures now ship as xz-compressed, evenly thinned 250-drawdpmirt_fitobjects with single-chainchain-aware-v1metadata and plot-ready DP-density summaries; session-bound compiled/raw NIMBLE storage is not included. - 31 manual pages generated with roxygen2 and including the current reserved interfaces and diagnostic contracts.
Compatibility Notes
- New and upgraded
dpmirt_fitobjects use thechain-aware-v1draw-storage schema. Fits created by older development versions may not containschema_version,chain_info,draw_index, orrun_historymetadata. - R-hat is reported only when at least two labeled chain/run streams are available. Single-chain fits should be assessed with ESS, trace summaries, posterior predictive checks, and substantive model diagnostics.
-
dpmirt_resume()requires a live compiled NIMBLE object in the current R session. Saved RDS files cannot restore compiled external pointers. -
dpmirt_draws()currently returns retained rescaled posterior draws. Raw/unrescaled draw extraction and disk-backed draw storage are reserved for a future release. - DP density recomputation no longer uses private NIMBLE namespace helpers. It loads retained DP draws through public
modelValuesaccessors before callinggetSamplesDPmeasure(). - Transformed-scale DP density output for 2PL/3PL IRT and SI fits should be interpreted as a diagnostic summary. Full scale/Jacobian-adjusted density reconstruction remains a documented future enhancement.