R package CDM. Functions for cognitive diagnosis modeling and multidimensional item response modeling for dichotomous and polytomous data. This package enables the estimation of the DINA and DINO model, the multiple group (polytomous) GDINA model, the multiple choice DINA model, the general diagnostic model (GDM), the multidimensional linear compensatory item response model and the structured latent class model (SLCA).