measr

R 패키지 메타데이터와 수집 신호를 모아 봅니다.

Packages / CRAN / measr

measr

v2.0.1
Repository CRANLicense GPL (>= 3)Lifecycle activeNeeds compilation yes
DOI
10.32614/CRAN.package.measr

Core Signals

첫 화면에서 판단해야 할 수집 신호를 먼저 배치합니다.

0
표시할 핵심 신호가 없습니다.

Supported Backends

DESCRIPTION에서 감지한 backend 관련 package입니다.

1
D
dtplyr
Imports

Quick Facts

기본 메타데이터를 작은 카드와 토큰으로 압축합니다.

profile
Repository
CRAN
Version
2.0.1
License
GPL (>= 3)
Lifecycle
active
Needs compilation
yes
Last observed
2026-05-30
CRAN
cran.r-project.org/package=measr

Build fields

LinkingTo
6
BH (>= 1.66.0)Rcpp (>= 0.12.0)RcppEigen (>= 0.3.3.3.0)RcppParallel (>= 5.0.1)rstan (>= 2.26.0)StanHeaders (>= 2.26.0)

수집 소스별 패키지 정보

1개 소스
CRAN
2.0.1
2026-05-30
License
GPL (>= 3)
Depends
R (>= 4.1.0)
Imports
bridgesampling, cli, dcm2, dcmstan (>= 0.1.0), dplyr (>= 1.1.1), dtplyr, fs, glue, lifecycle, loo, methods, posterior, psych, Rcpp (>= 0.12.0), RcppParallel (>= 5.0.1), rdcmchecks (>= 0.1.1), rlang (>= 1.1.0), rstan (>= 2.26.0), rstantools (>= 2.6.0), S7, stats, tibble, tidyr (>= 1.3.0)
Suggests
cmdstanr (>= 0.4.0), dcmdata, knitr, rmarkdown, roxygen2, spelling, testthat (>= 3.0.0), withr
LinkingTo
BH (>= 1.66.0), Rcpp (>= 0.12.0), RcppEigen (>= 0.3.3.3.0), RcppParallel (>= 5.0.1), rstan (>= 2.26.0), StanHeaders (>= 2.26.0)
Needs compilation
yes
Lifecycle
active
Last observed
2026-05-30 10:45:11

이 패키지가 의존하는 패키지

5개 표시전체 37개
PackageTypeSpec
bridgesampling
CRAN · 2.0.1 · 2026-05-30
Importsbridgesampling
cli
CRAN · 2.0.1 · 2026-05-30
Importscli
dcm2
CRAN · 2.0.1 · 2026-05-30
Importsdcm2
dcmstan
CRAN · 2.0.1 · 2026-05-30
Importsdcmstan (>= 0.1.0)
dplyr
CRAN · 2.0.1 · 2026-05-30
Importsdplyr (>= 1.1.1)
1 / 8

이 패키지를 쓰는 패키지

0개 표시전체 0개
PackageTypeSpec
표시할 dependency edge가 없습니다.
1 / 1

패키지 페이지

All links
61
Repository
CRAN
Version
2.0.1
Collected
2026-05-28 07:08:49
Package page
https://cran.r-project.org/web/packages/measr/index.html
DOI
10.32614/CRAN.package.measr
Citation
https://cran.r-project.org/web/packages/measr/citation.html
CRAN checks
https://cran.r-project.org/web/checks/check_results_measr.html
README
https://cran.r-project.org/web/packages/measr/readme/README.html
NEWS
https://cran.r-project.org/web/packages/measr/news/news.html
Reference HTML
https://cran.r-project.org/web/packages/measr/refman/measr.html
Reference PDF
https://cran.r-project.org/web/packages/measr/measr.pdf
Source package
https://cran.r-project.org/src/contrib/measr_2.0.1.tar.gz
Archive
https://CRAN.R-project.org/src/contrib/Archive/measr
Page fields
Additional Repositories
https://stan-dev.r-universe.dev
Author
W. Jake Thompson [aut, cre], Jeffrey Hoover [aut], Auburn Jimenez [ctb], Nathan Jones [ctb], Matthew Johnson [cph] (Authored code adapted for measrdcm method for `reliability()`), University of Kansas [cph], Institute of Education Sciences [fnd]
BugReports
https://github.com/r-dcm/measr/issues
CRAN Checks
measr results
Citation
measr citation info
DOI
10.32614/CRAN.package.measr
Language
en-US
License
GPL (≥ 3)
LinkingTo
BH (≥ 1.66.0), Rcpp (≥ 0.12.0), RcppEigen (≥ 0.3.3.3.0), RcppParallel (≥ 5.0.1), rstan (≥ 2.26.0), StanHeaders (≥ 2.26.0)
Maintainer
W. Jake Thompson <wjakethompson at gmail.com>
Materials
README , NEWS
NeedsCompilation
yes
Old Sources
measr archive
Package Source
measr_2.0.1.tar.gz
Published
2026-03-27
Reference Manual
measr.html , measr.pdf
SystemRequirements
GNU make
URL
https://measr.r-dcm.org , https://github.com/r-dcm/measr
Version
2.0.1
Vignettes
Getting started with measr ( source , R code ) measr: Bayesian psychometric measurement using Stan ( source )
Windows Binaries
r-devel: measr_2.0.1.zip , r-release: measr_2.0.1.zip , r-oldrel: measr_2.0.1.zip
MacOS Binaries
r-release (arm64): measr_2.0.1.tgz , r-oldrel (arm64): measr_2.0.1.tgz , r-release (x86_64): measr_2.0.1.tgz , r-oldrel (x86_64): measr_2.0.1.tgz
Version
2.0.1
LinkingTo
BH (≥ 1.66.0), Rcpp (≥ 0.12.0), RcppEigen (≥ 0.3.3.3.0), RcppParallel (≥ 5.0.1), rstan (≥ 2.26.0), StanHeaders (≥ 2.26.0)
Published
2026-03-27
DOI
10.32614/CRAN.package.measr
Author
W. Jake Thompson [aut, cre], Jeffrey Hoover [aut], Auburn Jimenez [ctb], Nathan Jones [ctb], Matthew Johnson [cph] (Authored code adapted for measrdcm method for `reliability()`), University of Kansas [cph], Institute of Education Sciences [fnd]
Maintainer
W. Jake Thompson <wjakethompson at gmail.com>
BugReports
https://github.com/r-dcm/measr/issues
License
GPL (≥ 3)
URL
https://measr.r-dcm.org , https://github.com/r-dcm/measr
NeedsCompilation
yes
SystemRequirements
GNU make
Additional Repositories
https://stan-dev.r-universe.dev
Language
en-US
Citation
measr citation info
Materials
README , NEWS
CRAN Checks
measr results
Reference Manual
measr.html , measr.pdf
Vignettes
Getting started with measr ( source , R code ) measr: Bayesian psychometric measurement using Stan ( source )
Package Source
measr_2.0.1.tar.gz
Windows Binaries
r-devel: measr_2.0.1.zip , r-release: measr_2.0.1.zip , r-oldrel: measr_2.0.1.zip
MacOS Binaries
r-release (arm64): measr_2.0.1.tgz , r-oldrel (arm64): measr_2.0.1.tgz , r-release (x86_64): measr_2.0.1.tgz , r-oldrel (x86_64): measr_2.0.1.tgz
Old Sources
measr archive
Page sections 3
Documentation
Heading
Documentation
Links
[{"label":"measr.html","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/refman/measr.html"},{"label":"measr.pdf","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/measr.pdf"},{"label":"Getting started with measr","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/vignettes/measr.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/vignettes/measr.Rmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/vignettes/measr.R"},{"label":"measr: Bayesian psychometric measurement using Stan","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/vignettes/paper.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/measr/vignettes/paper.Rmd"}]
Text
Reference manual: measr.html , measr.pdf Vignettes: Getting started with measr ( source , R code ) measr: Bayesian psychometric measurement using Stan ( source )
Downloads
Heading
Downloads
Links
[{"label":"measr_2.0.1.tar.gz","section":"","type":"","url":"https://cran.r-project.org/src/contrib/measr_2.0.1.tar.gz"},{"label":"measr_2.0.1.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.7/measr_2.0.1.zip"},{"label":"measr_2.0.1.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.6/measr_2.0.1.zip"},{"label":"measr_2.0.1.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.5/measr_2.0.1.zip"},{"label":"measr_2.0.1.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/sonoma-arm64/contrib/4.6/measr_2.0.1.tgz"},{"label":"measr_2.0.1.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-arm64/contrib/4.5/measr_2.0.1.tgz"},{"label":"measr_2.0.1.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-x86_64/contrib/4.6/measr_2.0.1.tgz"},{"label":"measr_2.0.1.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-x86_64/contrib/4.5/measr_2.0.1.tgz"},{"label":"measr archive","section":"","type":"","url":"https://CRAN.R-project.org/src/contrib/Archive/measr"}]
Text
Package source: measr_2.0.1.tar.gz Windows binaries: r-devel: measr_2.0.1.zip , r-release: measr_2.0.1.zip , r-oldrel: measr_2.0.1.zip macOS binaries: r-release (arm64): measr_2.0.1.tgz , r-oldrel (arm64): measr_2.0.1.tgz , r-release (x86_64): measr_2.0.1.tgz , r-oldrel (x86_64): measr_2.0.1.tgz Old sources: measr archive
Linking
Heading
Linking
Links
[{"label":"https://CRAN.R-project.org/package=measr","section":"","type":"","url":"https://CRAN.R-project.org/package=measr"}]
Text
Please use the canonical form https://CRAN.R-project.org/package=measr to link to this page.
Materials 2
Documentation 7
Vignettes 5
Downloads 9
All page links 61

패키지 문서 원문

5 artifacts
citation
Citation
CRAN · 2.0.1 · Citation · text/html · 959 · 2026-05-07
Title
CRAN: measr citation info
Label
Citation
Text content
Text content
CRAN: measr citation info Thompson WJ (2023). “measr: Bayesian psychometric measurement using Stan.” Journal of Open Source Software , 8 (91), 5742. doi:10.21105/joss.05742 . Corresponding BibTeX entry: @Article{, title = {{measr}: {Bayesian} psychometric measurement using {Stan}}, author = {W. Jake Thompson}, year = {2023}, journal = {Journal of Open Source Software}, volume = {8}, number = {91}, pages = {5742}, doi = {10.21105/joss.05742}, }
field
NEWS
CRAN · 2.0.1 · Materials · text/html · 14,485 · 2026-05-07
Title
NEWS
Label
NEWS
Text content
Text content
NEWS code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } div.sourceCode { margin: 1em 0; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ measr 2.0.1 Fix edge case that prevented that prevented the use of data with missing responses. add_fit() now automatically saves posterior draws when method = "ppmc" . cdi() now includes the real item identifiers in output. yens_q3() no longer errors when the pi-matrix contains rvars (#76). measr 2.0.0 Breaking changes The S3 parts of measr have been converted to {S7} . Some of measr’s functionality has been decoupled into other packages to allow for quicker and easier updates. The generation of Stan code and data lists have been moved to {dcmstan} . Similarly, the example data sets have been moved to {dcmdata} to facilitate the use of the data across other packages. As part of the decoupling, measr_dcm() has been deprecated in favor of dcmstan::dcm_specify() and dcm_estimate() . # old my_model <- measr_dcm ( data = ecpe_data, qmatrix = ecpe_qmatrix, resp_id = "resp_id" , item_id = "item_id" , type = "lcdm" , attribute_structure = "unconstrained" , method = "mcmc" ) # new library (dcmdata) my_spec <- dcm_specify ( qmatrix = ecpe_qmatrix, identifier = "item_id" , measurement_model = lcdm (), structural_model = unconstrained () ) my_model <- dcm_estimate ( dcm_spec = my_spec, data = ecpe_data, identifier = "resp_id" , method = "mcmc" ) predict() has been deprecated in favor of score() . The functionality is the same, but New features aic() and bic() have been added for estimating relative model fit for models estimated with method = "optim" ( @JeffreyCHoover , #54). bayes_factor() has been added for comparing models using Bayes factors. This is only available for models estimated with backend = "rstan" ( @JeffreyCHoover , #67). Item and attribute discrimination measures can now be calculated with cdi() ( @auburnhimenez34 , #63). The specified Q-matrix can now be evaluated and compared to other empirical Q-matrix specifications using qmatrix_validation() ( @JeffreyCHoover , #65). In reliability() , users can now calculate the classification accuracy and consistency for different probability classification threshold by specifying a threshold (#45). New estimation methods, variational() and pathfinder() , have been added to support estimation via Stan’s variational algorithm for approximate posterior sampling and the pathfinder variational inference algorithm, respectively. Pathfinder is only available when the model is estimated with {cmdstanr} (#72). Local item dependence can now be estimated with yens_q3() ( @JeffreyCHoover , #62). Minor improvements and fixes Documentation has been updated to ensure examples use Air formatting to improve accessibility (#68). measr_extract() has been updated to no longer require adding elements to a model object before extracting (#73). measr 1.0.0 New documentation A new article on model evaluation has been added to the project website (https://measr.r-dcm.org). The model estimation article has been updated to use the same (simulated) data set as the model evaluation article. More detailed installation instructions have been added to the getting started vignette (#23). A case study demonstrating a full DCM-based analysis using data from the ECPE ( ?ecpe_data ) has been added to the project website. Minor improvements and fixes Fixed bug in the LCDM specification of constraints for level-3 and above interaction terms. Functions for evaluating estimated models (e.g., fit_ppmc() , reliability() ) no longer recalculate indices if they have previously been saved to the model object. This behavior can be overwritten with force = TRUE . Updated Stan syntax to be compatible with the new array syntax ( @andrjohns , #36) get_parameters() now preserves item identifiers by default. Items can be renamed with numbers (e.g., 1, 2, 3, …) by setting rename_item = TRUE . measr now reexports functions from posterior for conducting mathematical operations on posterior::rvar() objects. Respondent estimates are now returned as posterior::rvar() objects when not summarized. measr 0.3.1 Added a NEWS.md file to track changes to the package. New features Support for additional model specifications has been added (#10): The compensatory reparameterized unified model (C-RUM) can now be estimated by defining type = "crum" in the measr_dcm() function. Users can now drop higher order interactions from the loglinear cognitive diagnostic model (LCDM). A new argument for measr_dcm() , max_interaction , defines the highest order interactions to estimate. For example, max_interaction = 2 will estimate only intercepts, main effects, and two-way interactions. A new argument to measr_dcm() , attribute_structure allows users to specified either “unconstrained” relationships between attributes or “independent” attributes. Updated prior speci
field
README
CRAN · 2.0.1 · Materials · text/html · 13,872 · 2026-05-07
Title
README
Label
README
Text content
Text content
README code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } div.sourceCode { margin: 1em 0; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ measr Diagnostic classification models (DCMs) are a class of psychometric models that estimate respondent abilities as a profile of proficiency on a pre-defined set of skills, or attributes. Despite the utility of DCMs for providing fine-grained and actionable feedback with shorter assessments, they have are not widely used in applied settings, in part due to a lack of user-friendly software. Using R and Stan , measr (said: “measure”) simplifies the process of estimating and evaluating DCMs. Users can specify different DCM subtypes, define prior distributions, and estimate the model using the rstan or cmdstanr interface to Stan. You can then easily examine model parameters, calculate model fit metrics, compare competing models, and evaluate the reliability of the attributes. Installation You can install the released version of measr from CRAN with: install.packages ( "measr" ) To install the development version of measr from GitHub use: # install.packages("remotes") remotes :: install_github ( "r-dcm/measr" ) Because measr is based on Stan, a C++ compiler is required. For Windows, the Rtools program comes with a C++ compiler. On Mac, it’s recommended that you install Xcode. For additional instructions and help setting up the compilers, see the RStan installation help page . Usage We can define a DCM using dcm_specify() . This function requires a Q-matrix defining which attributes are measured by each item. We also identify any item identifier columns. Other arguments can be specified to customize the type of model to estimate (e.g., type of measurement or structural model; see ?dcmstan::dcm_specify() ). We can then estimate our specified DCM using dcm_estimate() . We supply our specification and our data set, along with any respondent identifiers. As with dcm_specify() , other arguments can be specified to customize the model estimation process (e.g., estimation backend and method; see ?dcm_estimate() ). To demonstrate measr’s functionality, example data sets are available in the dcmdata package. Here we use the Examination of Certificate of Proficiency in English (ECPE; Templin & Hoffman, 2013 ) data (see ?dcmdata::ecpe for details). Note that by default, measr uses a full Markov chain Monte Carlo (MCMC) estimation with Stan, which can be time and computationally intensive. For a quicker estimation, we could use Stan’s optimizer instead of MCMC by adding method = "optim" to the function call. However, please note that some functionality will be lost when using the optimizer (e.g., the calculation of some model fit criteria requires the use of MCMC). library (measr) model_spec <- dcm_specify (dcmdata :: roarpa_qmatrix, identifier = "item" ) model <- dcm_estimate ( dcm_spec = model_spec, data = dcmdata :: roarpa_data, identifier = "id" , method = "optim" , seed = 69385 , refresh = 0 ) Once a model has been estimated, model parameters, respondent classifications, and results of the model fit analyses can then be extracted using measr_extract() . measr_extract (model, "m2" ) #> # A tibble: 1 × 3 #> m2 df pval #> <dbl> <int> <dbl> #> 1 NA 1532 NA measr_extract (model, "classification_reliability" ) #> # A tibble: 3 × 3 #> attribute accuracy consistency #> <chr> <dbl> <dbl> #> 1 lsm 0.984 0.969 #> 2 del 0.967 0.939 #> 3 fsm 0.986 0.973 Contributions are welcome. To ensure a smooth process, please review the Contributing Guide . Please note that the measr project is released with a Contributor Code of Conduct . By contributing to this project, you agree to abide by its terms.
reference_manual_html
Reference manual HTML
CRAN · 2.0.1 · Documentation · text/html · 106,023 · 2026-05-07
Title
Help for package measr
Label
Reference manual HTML
Text content
Text content
Help for package measr const macros = { "\\R": "\\textsf{R}", "\\mbox": "\\text", "\\code": "\\texttt"}; function processMathHTML() { var l = document.getElementsByClassName('reqn'); for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); } return; } Package {measr} Contents measr-package aic bayes_factor cdi dcm_estimate fit_ppmc log_mll loglik_array loo-waic m2 measr_dcm measr_examples measr_extract measrdcm model_evaluation qmatrix_validation reexports reliability score stan-classes tidyeval yens_q3 Title: Bayesian Psychometric Measurement Using 'Stan' Version: 2.0.1 Description: Estimate diagnostic classification models (also called cognitive diagnostic models) with 'Stan'. Diagnostic classification models are confirmatory latent class models, as described by Rupp et al. (2010, ISBN: 978-1-60623-527-0). Automatically generate 'Stan' code for the general loglinear cognitive diagnostic diagnostic model proposed by Henson et al. (2009) < doi:10.1007/s11336-008-9089-5 > and other subtypes that introduce additional model constraints. Using the generated 'Stan' code, estimate the model evaluate the model's performance using model fit indices, information criteria, and reliability metrics. License: GPL (≥ 3) URL: https://measr.r-dcm.org , https://github.com/r-dcm/measr BugReports: https://github.com/r-dcm/measr/issues Depends: R (≥ 4.1.0) Imports: bridgesampling, cli, dcm2, dcmstan (≥ 0.1.0), dplyr (≥ 1.1.1), dtplyr, fs, glue, lifecycle, loo, methods, posterior, psych, Rcpp (≥ 0.12.0), RcppParallel (≥ 5.0.1), rdcmchecks (≥ 0.1.1), rlang (≥ 1.1.0), rstan (≥ 2.26.0), rstantools (≥ 2.6.0), S7, stats, tibble, tidyr (≥ 1.3.0) LinkingTo: BH (≥ 1.66.0), Rcpp (≥ 0.12.0), RcppEigen (≥ 0.3.3.3.0), RcppParallel (≥ 5.0.1), rstan (≥ 2.26.0), StanHeaders (≥ 2.26.0) Suggests: cmdstanr (≥ 0.4.0), dcmdata, knitr, rmarkdown, roxygen2, spelling, testthat (≥ 3.0.0), withr Additional_repositories: https://stan-dev.r-universe.dev Config/testthat/edition: 3 Config/Needs/website: r-dcm/rdcmtemplate, wjakethompson/wjake, showtext, ggdist, english Config/Needs/documentation: openpharma/roxylint Config/roxylint: list(linters = roxylint::tidy) Encoding: UTF-8 Language: en-US RoxygenNote: 7.3.3 Biarch: true SystemRequirements: GNU make VignetteBuilder: knitr NeedsCompilation: yes Packaged: 2026-03-27 16:58:59 UTC; jakethompson Author: W. Jake Thompson [aut, cre], Jeffrey Hoover [aut], Auburn Jimenez [ctb], Nathan Jones [ctb], Matthew Johnson [cph] (Authored code adapted for measrdcm method for `reliability()`), University of Kansas [cph], Institute of Education Sciences [fnd] Maintainer: W. Jake Thompson <wjakethompson@gmail.com> Repository: CRAN Date/Publication: 2026-03-27 19:40:02 UTC measr: Bayesian Psychometric Measurement Using 'Stan' Description Estimate diagnostic classification models (also called cognitive diagnostic models) with 'Stan'. Diagnostic classification models are confirmatory latent class models, as described by Rupp et al. (2010, ISBN: 978-1-60623-527-0). Automatically generate 'Stan' code for the general loglinear cognitive diagnostic diagnostic model proposed by Henson et al. (2009) doi:10.1007/s11336-008-9089-5 and other subtypes that introduce additional model constraints. Using the generated 'Stan' code, estimate the model evaluate the model's performance using model fit indices, information criteria, and reliability metrics. Author(s) Maintainer : W. Jake Thompson wjakethompson@gmail.com ( ORCID ) Authors: Jeffrey Hoover jeffrey.c.hoover@gmail.com ( ORCID ) Other contributors: Auburn Jimenez auburn.jimenez34@gmail.com ( ORCID ) [contributor] Nathan Jones jonesnateb@gmail.com ( ORCID ) [contributor] Matthew Johnson (Authored code adapted for measrdcm method for 'reliability()') [copyright holder] University of Kansas [copyright holder] Institute of Education Sciences [funder] See Also Useful links: https://measr.r-dcm.org https://github.com/r-dcm/measr Report bugs at https://github.com/r-dcm/measr/issues Maximum likelihood based information criteria Description Calculate information criteria for diagnostic models not estimated with full Markov chain Monte Carlo (i.e., with method = "optim" ). Available information include the Akaike information criterion (AIC; Akaike, 1973) and the Bayesian information criterion (BIC; Schwarz, 1978). Usage aic(x, ..., force = FALSE) bic(x, ..., force = FALSE) Arguments x A measrdcm object estimated with backend = "optim" . ... Unused. force If the criterion has already been added to the model object with add_criterion() , should it be recalculated. Default is FALSE . Value The numeric value of the information criterion. References Akaike, H. (1973). Information theory and an extension of the maximum likelihood principle. In B. N. Petrov & F. Csáki (Eds.), Proceedings of the Second International Symposium on Information Theory (pp. 267-281). Akademiai Kiado. Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6 (2), 461–464. doi:10.1214/aos/1176344136 Examples model_spec <- dcm_specify( qmatrix = dcmdata::mdm_qmatrix, identifier = "item" ) model <- dcm_estimate( dcm_spec = model_spec, data = dcmdata::mdm_data, identifier = "respondent", method = "optim", seed = 63277 ) aic(model) bic(model) Bayes factor for model comparisons Description Calculate the Bayes factor for model comparisons, which represents the posterior odds of the null hypothesis when the prior probability of the null model is 0.5 (Jeffreys, 1935; Kass & Raftery, 1995). Consistent with the Bayesian reporting guidelines from Kruschke (2021), we calculate the posterior probability of the null model for a variety of prior probabilities, in addition to the Bayes factor. Usage bayes_factor( x, ..., model_names = NULL, prior_prob = seq(0.02, 0.98, by = 0.02) ) Arguments x A measrdcm object. ... Additional measrdcm to be compared to x . model_names Names given to each provided model in the comparison output. If NULL (the default), the names will be parsed from the names of the objects passed for comparison. prior_prob A numeric vector of prior probabilities for the null model used to calculate the posterior probability of the null model relative to alternative model. See details for more information. Details Bayes factors will be calculated for all possible pairwise comparisons between the models provided to x and ... . In each comparison, one model is identified as the null model, and the other is the alternative. This distinction is not terribly meaningful from a calculation standpoint, as the probabilities for the alternative model are simply 1 minus the null probabilities. If you want particular models to be labeled as the "null", the determination is made by the order the models are sent to the function. That is, x will always be the null model. The first model included in ... will be the alternative model when compared to x and the null model when compared to all other models included in ... . Similarly, the second model included in ... will be the alternative model when compared to x and the first model included in ... and the null model in all other comparisons. prior_prob is used to specify a vector of possible prior probabilities for the null model. These are used in conjunction with the Bayes factor to determine the posterior model probability for the null model, relative to the alternative model. The posterior probability for the alternative model can be calculated as 1 minus the null model's posterior probability. You may specify a specific prior probability, or specify a range of possibilities to construct a graph similar to Kruschke's (2021) Figure 1. These probabilities can be interpreted as, "If the prior probability is { prior_prob_null }, then the posterior is { posterior_prob_null }" (or 1 minus for the alternative model). Value A tibble with one row per model comparison and four columns. null_model : The null model in the comparison. alt_model :
section
measr.pdf
CRAN · 2.0.1 · Documentation · application/pdf · 242,006 · 2026-05-07
Title
measr.pdf
Label
measr.pdf

Reference for measr (2.0.1)

22개 topic
aic
Maximum likelihood based information criteria
CRAN · 2.0.1 · measr/man/aic-bic.Rd · 2026-05-07

Calculate information criteria for diagnostic models not estimated with full Markov chain Monte Carlo (i.e., with method = "optim"). Available information include the Akaike information criterion (AIC; Akaike, 1973) and the Bayesian information criterion (BIC; Schwarz, 1978).

Aliases
aicbic
Usage
aic(x, ..., force = FALSE) bic(x, ..., force = FALSE)
Arguments
x
A [=dcm_estimate]measrdcm object estimated with backend = "optim".
...
Unused.
force
If the criterion has already been added to the model object with [=add_criterion]add_criterion(), should it be recalculated. Default is FALSE.
Value
The numeric value of the information criterion.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf model_spec <- dcm_specify( qmatrix = dcmdata::mdm_qmatrix, identifier = "item" ) model <- dcm_estimate( dcm_spec = model_spec, data = dcmdata::mdm_data, identifier = "respondent", method = "optim", seed = 63277 ) aic(model) bic(model) \) # examplesIf
References
Akaike, H. (1973). Information theory and an extension of the maximum likelihood principle. In B. N. Petrov & F. Csáki (Eds.), Proceedings of the Second International Symposium on Information Theory (pp. 267-281). Akademiai Kiado. Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6(2), 461–464. 10.1214/aos/1176344136
bayes_factor
Bayes factor for model comparisons
CRAN · 2.0.1 · measr/man/bayes_factor.Rd · 2026-05-07

Calculate the Bayes factor for model comparisons, which represents the posterior odds of the null hypothesis when the prior probability of the null model is 0.5 (Jeffreys, 1935; Kass & Raftery, 1995). Consistent with the Bayesian reporting guidelines from Kruschke (2021), we calculate the posterior probability of the null model for a variety of prior probabilities, in addition to the Bayes factor.

Aliases
bayes_factor
Concepts
Bayes
Usage
bayes_factor( x, ..., model_names = NULL, prior_prob = seq(0.02, 0.98, by = 0.02) )
Arguments
x
A [=dcm_estimate]measrdcm object.
...
Additional [=dcm_estimate]measrdcm to be compared to x.
model_names
Names given to each provided model in the comparison output. If NULL (the default), the names will be parsed from the names of the objects passed for comparison.
prior_prob
A numeric vector of prior probabilities for the null model used to calculate the posterior probability of the null model relative to alternative model. See details for more information.
Details
Bayes factors will be calculated for all possible pairwise comparisons between the models provided to x and .... In each comparison, one model is identified as the null model, and the other is the alternative. This distinction is not terribly meaningful from a calculation standpoint, as the probabilities for the alternative model are simply 1 minus the null probabilities. If you want particular models to be labeled as the "null", the determination is made by the order the models are sent to the function. That is, x will always be the null model. The first model included in ... will be the alternative model when compared to x and the null model when compared to all other models included in .... Similarly, the second model included in ... will be the alternative model when compared to x and the first model included in ... and the null model in all other comparisons. prior_prob is used to specify a vector of possible prior probabilities for the null model. These are used in conjunction with the Bayes factor to determine the posterior model probability for the null model, relative to the alternative model. The posterior probability for the alternative model can be calculated as 1 minus the null model's posterior probability. You may specify a specific prior probability, or specify a range of possibilities to construct a graph similar to Kruschke's (2021) Figure 1. These probabilities can be interpreted as, "If the prior probability is \prior_prob_null\, then the posterior is \posterior_prob_null\" (or 1 minus for the alternative model).
Value
A [tibble:tibble-package]tibble with one row per model comparison and four columns. null_model: The null model in the comparison. alt_model: The alternative model in the comparison. bf: The estimated Bayes factor. posterior_probs: A nested list column, where element element is a tibble with two columns: prior_prob_null: The prior probability that the null model is correct. posterior_prob_null: The posterior probability that the null model is correct. The list column can be unnested with [tidyr:unnest]tidyr::unnest() (see examples). If prior_prob is NULL, the posterior_probs column is excluded from the returned object.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf mdm_dina <- dcm_estimate( dcm_specify( qmatrix = dcmdata::mdm_qmatrix, identifier = "item", measurement_model = dina() ), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "mcmc", seed = 63277, backend = "rstan", iter = 700, warmup = 500, chains = 2, refresh = 0 ) mdm_dino <- dcm_estimate( dcm_specify( qmatrix = dcmdata::mdm_qmatrix, identifier = "item", measurement_model = dino() ), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "mcmc", seed = 63277, backend = "rstan", iter = 700, warmup = 500, chains = 2, refresh = 0 ) bf <- bayes_factor(mdm_dina, mdm_dino) bf tidyr::unnest(bf, "posterior_probs") \) # examplesIf
References
Jeffreys, H. (1935). Some tests of significance, treated by the theory of probability. Mathematical Proceedings of the Cambridge Philosophical Society, 31(2), 203-222. 10.1017/S030500410001330X Kass, R. E., & Raftery, A. E. (1995). Bayes factors. Journal of the American Statistical Association, 90(430), 773-795. 10.1080/01621459.1995.10476572 Kruschke, J. K. (2021). Bayesian analysis reporting guidelines. Nature, 5, 1282-1291. 10.1038/s41562-021-01177-7
cdi
Item, attribute, and test-level discrimination indices
CRAN · 2.0.1 · measr/man/cdi.Rd · 2026-05-07

The cognitive diagnostic index (CDI) is a measure of how well an assessment is able to distinguish between attribute profiles. The index was originally proposed by Henson & Douglas (2005) for item- and test-level discrimination, and then expanded by Henson et al. (2008) to include attribute-level discrimination indices.

Aliases
cdi
Usage
cdi(model, weight_prevalence = TRUE)
Arguments
model
The estimated model to be evaluated.
weight_prevalence
Logical indicating whether the discrimination indices should be weighted by the prevalence of the attribute profiles. See details for additional information.
Details
Henson et al. (2008) described two attribute-level discrimination indices, d_(A) (Equation 8) and d_(B) (Equation 13), which are similar in that both are the sum of item-level discrimination indices. In both cases, item-level discrimination indices are calculated as the average of Kullback-Leibler information for all pairs of attributes profiles for the item. The item-level indices are then summed to achieve the test-level discrimination index for each attribute, or the test overall. However, whereas d_(A) is an unweighted average of the Kullback-Leibler information, d_(B) is a weighted average, where the weight is defined by the prevalence of each profile (i.e., [=measr_extract]measr_extract(model, what = "strc_param")).
Value
A list with two elements: item_discrimination: A [tibble:tibble-package]tibble with one row per item containing the CDI for the item and any relevant attributes. test_discrimination: A [tibble:tibble-package]tibble with one row containing the total CDI for the assessment and for each attribute.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_ecpe_lcdm <- dcm_estimate( dcm_specify(dcmdata::ecpe_qmatrix, identifier = "item_id"), data = dcmdata::ecpe_data, missing = NA, identifier = "resp_id", method = "optim", seed = 63277, backend = "rstan" ) cdi(rstn_ecpe_lcdm) \) # examplesIf
References
Henson, R., & Douglas, J. (2005). Test construction for cognitive diagnosis. Applied Psychological Measurement, 29(4), 262-277. 10.1177/0146621604272623 Henson, R., Roussos, L., Douglas, J., & Xuming, H. (2008). Cognitive diagnostic attribute-level discrimination indices. Applied Psychological Measurement, 32(4), 275-288. 10.1177/0146621607302478
dcm_estimate
Fit Bayesian diagnostic classification models
CRAN · 2.0.1 · measr/man/dcm_estimate.Rd · 2026-05-07

Estimate diagnostic classification models (DCMs; also known as cognitive diagnostic models) using 'Stan'. Models can be estimated using Stan's optimizer, or full Markov chain Monte Carlo (MCMC).

Aliases
dcm_estimate
Concepts
BayesianCmdDCMModelStan
Usage
dcm_estimate( dcm_spec, data, missing = NA, identifier = NULL, method = c("variational", "mcmc", "optim", "pathfinder"), backend = getOption("measr.backend", "rstan"), file = NULL, file_refit = getOption("measr.file_refit", "never"), ... )
Arguments
dcm_spec
A DCM specification created with [=dcm_specify]dcm_specify().
data
Response data. A data frame with 1 row per respondent and 1 column per item.
missing
An R expression specifying how missing data in data is coded (e.g., NA, ".", -99, etc.). The default is NA.
identifier
Optional. Variable name of a column in data that contains respondent identifiers. NULL (the default) indicates that no identifiers are present in the data, and row numbers will be used as identifiers.
method
Estimation method. Options are "variational", which uses Stan's variational algorithm; "mcmc", which uses Stan's sampling method; "optim", which uses Stan's optimizer; or "pathfinder" which uses Stan's pathfinder variational inference algorithm (only available if backend = "cmdstanr").
backend
Character string naming the package to use as the backend for fitting the Stan model. Options are "rstan" (the default) or "cmdstanr". Can be set globally for the current R session via the "measr.backend" option (see [=options]options()). Details on the rstan and cmdstanr packages are available at https://mc-stan.org/rstan/ and https://mc-stan.org/cmdstanr/, respectively.
file
Either NULL (the default) or a character string. If a character string, the fitted model object is saved as an .rds object using [=saveRDS]saveRDS() using the supplied character string. The .rds extension is automatically added. If the specified file already exists, measr will load the previously saved model. Unless file_refit is specified, the model will not be refit.
file_refit
Controls when a saved model is refit. Options are "never", "always", and "on_change". Can be set globally for the current R session via the "measr.file_refit" option (see [=options]options()). For "never" (the default), the fitted model is always loaded if the file exists, and model fitting is skipped. For "always", the model is always refitted, regardless of whether or not file exists. For "on_change", the model will be refit if the dcm_spec, data, method, or backend specified are different from that in the saved file.
...
Additional arguments passed to Stan. For backend = "rstan", arguments are passed to [rstan:stanmodel-method-sampling]rstan::sampling() or [rstan:stanmodel-method-optimizing]rstan::optimizing(). For backend = "cmdstanr", arguments are passed to the [cmdstanr:model-method-sample]$sample() or [cmdstanr:model-method-optimize]$optimize() methods of the [cmdstanr:CmdStanModel]CmdStanModel class.
Value
A measrdcm object.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf model_spec <- dcm_specify( qmatrix = dcmdata::mdm_qmatrix, identifier = "item" ) model <- dcm_estimate( dcm_spec = model_spec, data = dcmdata::mdm_data, identifier = "respondent", method = "optim", seed = 63277 ) \) # examplesIf
fit_ppmc
Posterior predictive model checks for assessing model fit
CRAN · 2.0.1 · measr/man/fit_ppmc.Rd · 2026-05-07

For models estimated with a method that results in posterior distributions (e.g., "mcmc", "variational"), use the posterior distributions to compute expected distributions for fit statistics and compare to values in the observed data.

Aliases
fit_ppmc
Usage
fit_ppmc( x, ..., model_fit = NULL, item_fit = NULL, ndraws = NULL, probs = c(0.025, 0.975), return_draws = 0, force = FALSE )
Arguments
x
An estimated model object (e.g., from [=dcm_estimate]dcm_estimate()).
...
Unused. For future extensions.
model_fit
The posterior predictive model checks to compute for an evaluation of model-level fit. If NULL, no model-level checks are computed. See details.
item_fit
The posterior predictive model checks to compute for an evaluation of item-level fit. If NULL, no item-level checks are computed. See details.
ndraws
The number of posterior draws to base the checks on. Must be less than or equal to the total number of posterior draws retained in the estimated model. If NULL (the default) the total number from the estimated model is used.
probs
The percentiles to be computed by the [stats:quantile]stats::quantile() function for summarizing the posterior distribution for each fit statistic.
return_draws
Number of posterior draws for each specified fit statistic to be returned. This does not affect the calculation of the posterior predictive checks, but can be useful for visualizing the fit statistics. Must be less than ndraws (or the total number of draws if ndraws = NULL). If 0 (the default), only summaries of the posterior are returned (no individual samples).
force
If all requested PPMCs have already been added to the model object using [=add_fit]add_fit(), should they be recalculated. Default is FALSE.
Details
Posterior predictive model checks (PPMCs) use the posterior distribution of an estimated model to compute different statistics. This creates an expected distribution of the given statistic, if our estimated parameters are correct. We then compute the statistic in our observed data and compare the observed value to the expected distribution. Observed values that fall outside of the expected distributions indicate incompatibility between the estimated model and the observed data. For DCMs, we currently support PPMCs at the model and item level. At the model level, we calculate the expected raw score distribution (model_fit = "raw_score") as described by Thompson (2019) and Park et al. (2015). At the item level, we can calculate the conditional probability that a respondent in each class provides a correct response (item_fit = "conditional_prob") as described by Thompson (2019) and Sinharay & Almond (2007) or the overall proportion correct for an item (item_fit = "pvalue"), as described by Thompson (2019). We can also calculate the odds ratio for each pair of items (item_fit = "odds_ratio") as described by Park et al. (2015) and Sinharay et al. (2006).
Value
A list with two elements, "model_fit" and "item_fit". If either model_fit = NULL or item_fit = NULL in the function call, this will be a one-element list, with the null criteria excluded. Each list element, is itself a list with one element for each specified PPMC containing a [tibble:tibble-package]tibble. For example if item_fit = c("conditional_prob", "odds_ratio"), the "item_fit" element will be a list of length two, where each element is a tibble containing the results of the PPMC. All tibbles follow the same general structure: obs_\ppmc\: The value of the relevant statistic in the observed data. ppmc_mean: The mean of the ndraws posterior samples calculated for the given statistic. Quantile columns: 1 column for each value of probs, providing the corresponding quantiles of the ndraws posterior samples calculated for the given statistic. samples: A list column, where each element contains a vector of length return_draws, representing samples from the posterior distribution of the calculated statistic. This column is excluded if return_draws = 0. ppp: The posterior predictive p-value. This is the proportion of posterior samples for calculated statistic that are greater than the observed value. Values very close to 0 or 1 indicate incompatibility between the fitted model and the observed data.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf mdm_dina <- dcm_estimate( dcm_specify( dcmdata::mdm_qmatrix, identifier = "item", measurement_model = dina() ), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "mcmc", seed = 63277, backend = "rstan", iter = 700, warmup = 500, chains = 2, refresh = 0 ) fit_ppmc(mdm_dina, model_fit = "raw_score") \) # examplesIf
References
Park, J. Y., Johnson, M. S., Lee, Y-S. (2015). Posterior predictive model checks for cognitive diagnostic models. International Journal of Quantitative Research in Education, 2(3-4), 244-264. 10.1504/IJQRE.2015.071738 Sinharay, S., & Almond, R. G. (2007). Assessing fit of cognitive diagnostic models. Educational and Psychological Measurement, 67(2), 239-257. 10.1177/0013164406292025 Sinharay, S., Johnson, M. S., & Stern, H. S. (2006). Posterior predictive assessment of item response theory models. Applied Psychological Measurement, 30(4), 298-321. 10.1177/0146621605285517 Thompson, W. J. (2019). Bayesian psychometrics for diagnostic assessments: A proof of concept (Research Report No. 19-01). University of Kansas; Accessible Teaching, Learning, and Assessment Systems. 10.35542/osf.io/jzqs8
log_mll
Log marginal likelihood calculation
CRAN · 2.0.1 · measr/man/log_mll.Rd · 2026-05-07

Calculate the log marginal likelihood with bridge sampling (Meng & Wong, 1996). This is a wrapper around [bridgesampling:bridge_sampler]bridgesampling::bridge_sampler(). Therefore, log marginal likelihood calculation is currently only available for models estimated with rstan using MCMC.

Aliases
log_mll
Usage
log_mll(x, ..., force = FALSE)
Arguments
x
A [=dcm_estimate]measrdcm object estimated with backend = "optim".
...
Unused.
force
If the criterion has already been added to the model object with [=add_criterion]add_criterion(), should it be recalculated. Default is FALSE.
Value
The estimate of the log marginal likelihood.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf model_spec <- dcm_specify( qmatrix = dcmdata::mdm_qmatrix, identifier = "item" ) model <- dcm_estimate( dcm_spec = model_spec, data = dcmdata::mdm_data, identifier = "respondent", method = "variational", seed = 63277 ) log_mll(model) \) # examplesIf
References
Meng, X.-L., & Wong, W. H. (1996). Simulating ratios of normalizing constants via a simple identity: A theoretical exploration. Statistical Sinica, 6(4), 831-860. https://www.jstor.org/stable/24306045
loglik_array
Extract the log-likelihood of an estimated model
CRAN · 2.0.1 · measr/man/loglik_array.Rd · 2026-05-07

The loglik_array() methods for [=dcm_estimate]measrdcm objects calculates the log-likelihood for an estimated model via the generated quantities functionality in Stan and returns the draws of the log_lik parameter.

Aliases
loglik_array
Usage
loglik_array(model, ...)
Arguments
model
A [=dcm_estimate]measrdcm object.
...
Unused. For future extensions.
Value
A "[posterior:draws_array]draws_array" object containing the log-likelihood estimates for the model.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_mdm_lcdm <- dcm_estimate( dcm_specify(dcmdata::mdm_qmatrix, identifier = "item"), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "optim", seed = 63277, backend = "rstan" ) loglik_array(rstn_mdm_lcdm) \) # examplesIf
loo-waic
Relative fit for Bayesian models
CRAN · 2.0.1 · measr/man/loo-waic.Rd · 2026-05-07

For models estimated with MCMC, relative model fit comparisons can be made using the LOO-CV or WAIC indicates (Vehtari et al., 2017). These functions are wrappers for the [loo:loo-package]loo package. See the loo package https://mc-stan.org/loo/articles/vignettes for details on the implementation.

Aliases
loo-waicloo.measr::measrdcmwaic.measr::measrdcmloo_compare.measr::measrdcm
Concepts
Bayesian
Usage
loo`measr::measrdcm`(x, ..., r_eff = NA, force = FALSE) waic`measr::measrdcm`(x, ..., force = FALSE) loo_compare`measr::measrdcm`(x, ..., criterion = c("loo", "waic"), model_names = NULL)
Arguments
x
A [=dcm_estimate]measrdcm object.
...
For loo() and waic(), additional arguments passed to [loo:loo]loo::loo.array() or [loo:waic]loo::waic.array(), respectively. For loo_compare(), additional [=dcm_estimate]measrdcm objects to be compared to x.
r_eff
Vector of relative effective sample size estimates for the likelihood (exp(log_lik)) of each observation. This is related to the relative efficiency of estimating the normalizing term in self-normalized importance sampling when using posterior draws obtained with MCMC. If MCMC draws are used and r_eff is not provided then the reported PSIS effective sample sizes and Monte Carlo error estimates can be over-optimistic. If the posterior draws are (near) independent then r_eff=1 can be used. r_eff has to be a scalar (same value is used for all observations) or a vector with length equal to the number of observations. The default value is 1. See the [loo:relative_eff]relative_eff() helper functions for help computing r_eff.
force
If the LOO criterion has already been added to the model object with [=add_criterion]add_criterion(), should it be recalculated. Default is FALSE.
criterion
The name of the criterion to be extracted from the x for comparison.
model_names
Names given to each provided model in the comparison output. If NULL (the default), the names will be parsed from the names of the objects passed for comparison.
Value
For loo() and waic(), the information criteria returned by [loo:loo]loo::loo.array() or [loo:waic]loo::waic.array(), respectively. For loo_compare(), the criterion comparison returned by [loo:loo_compare]loo::loo_compare().
References
Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5), 1413-1432. 10.1007/s11222-016-9696-4
m2
Estimate the htmlM<sub>2</sub>M_2 fit statistic for diagnostic classification models
CRAN · 2.0.1 · measr/man/m2.Rd · 2026-05-07

For diagnostic classification models, the htmlM<sub>2</sub>M_2 statistic is calculated as described by Hansen et al. (2016) and Liu et al. (2016).

Aliases
m2fit_m2.measr::measrdcm
Usage
fit_m2`measr::measrdcm`(model, ..., ci = 0.9, force = FALSE)
Arguments
model
An estimated diagnostic classification model.
...
Unused, for extensibility.
ci
The confidence interval for the RMSEA.
force
If the htmlM<sub>2</sub>M_2 has already been saved to the model object with [=add_fit]add_fit(), should it be recalculated. Default is FALSE.
Value
A data frame created by [dcm2:fit_m2]dcm2::fit_m2().
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_mdm_lcdm <- dcm_estimate( dcm_specify(dcmdata::mdm_qmatrix, identifier = "item"), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "optim", seed = 63277, backend = "rstan" ) fit_m2(rstn_mdm_lcdm) \) # examplesIf
References
Hansen, M., Cai, L., Monroe, S., & Li, Z. (2016). Limited-information goodness-of-fit testing of diagnostic classification item response models. British Journal of Mathematical and Statistical Psychology, 69(3), 225-252. 10.1111/bmsp.12074 Liu, Y., Tian, W., & Xin, T. (2016). An application of htmlM<sub>2</sub>M_2 statistic to evaluate the fit of cognitive diagnostic models. Journal of Educational and Behavioral Statistics, 41(1), 3-26. 10.3102/1076998615621293
measr-package
measr: Bayesian Psychometric Measurement Using 'Stan'
CRAN · 2.0.1 · package · measr/man/measr-package.Rd · 2026-05-07

htmllogo.pngoptions: style='float: right' alt='logo' width='120' Estimate diagnostic classification models (also called cognitive diagnostic models) with 'Stan'. Diagnostic classification models are confirmatory latent class models, as described by Rupp et al. (2010, ISBN: 978-1-60623-527-0). Automatically generate 'Stan' code for the general loglinear cognitive diagnostic diagnostic model proposed by Henson et al. (2009) 10.1007/s11336-008-9089-5 and other subtypes that introduce additional model constraints. Using the generated 'Stan' code, estimate the model evaluate the model's performance using model fit indices, information criteria, and reliability metrics.

Aliases
measrmeasr-package
Keywords
internal
See also
Useful links: https://measr.r-dcm.org https://github.com/r-dcm/measr Report bugs at https://github.com/r-dcm/measr/issues
Author
Maintainer: W. Jake Thompson wjakethompson@gmail.com (https://orcid.org/0000-0001-7339-0300ORCID) Authors: Jeffrey Hoover jeffrey.c.hoover@gmail.com (https://orcid.org/0000-0002-0276-0308ORCID) Other contributors: Auburn Jimenez auburn.jimenez34@gmail.com (https://orcid.org/0000-0002-7072-2960ORCID) [contributor] Nathan Jones jonesnateb@gmail.com (https://orcid.org/0000-0001-6177-7161ORCID) [contributor] Matthew Johnson (Authored code adapted for measrdcm method for `reliability()`) [copyright holder] University of Kansas [copyright holder] Institute of Education Sciences [funder]
measr_dcm
Fit Bayesian diagnostic classification models
CRAN · 2.0.1 · measr/man/measr_dcm.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] measr_dcm() has been deprecated in favor of [=dcm_estimate]dcm_estimate(). Please use [=dcm_estimate]dcm_estimate(), as measr_dcm() will be removed in a future release.

Aliases
measr_dcm
Keywords
internal
Concepts
BayesianStan
Usage
measr_dcm( data, missing = NA, qmatrix, resp_id = NULL, item_id = NULL, type = c("lcdm", "dina", "dino", "crum"), max_interaction = Inf, attribute_structure = c("unconstrained", "independent"), method = c("variational", "mcmc", "optim"), prior = NULL, backend = getOption("measr.backend", "rstan"), file = NULL, file_refit = getOption("measr.file_refit", "never"), ... )
Arguments
data
Response data. A data frame with 1 row per respondent and 1 column per item.
missing
An R expression specifying how missing data in data is coded (e.g., NA, ".", -99, etc.). The default is NA.
qmatrix
The Q-matrix. A data frame with 1 row per item and 1 column per attribute. All cells should be either 0 (item does not measure the attribute) or 1 (item does measure the attribute).
resp_id
Optional. Variable name of a column in data that contains respondent identifiers. NULL (the default) indicates that no identifiers are present in the data, and row numbers will be used as identifiers.
item_id
Optional. Variable name of a column in qmatrix that contains item identifiers. NULL (the default) indicates that no identifiers are present in the Q-matrix. In this case, the column names of data (excluding any column specified in resp_id) will be used as the item identifiers. NULL also assumes that the order of the rows in the Q-matrix is the same as the order of the columns in data (i.e., the item in row 1 of qmatrix is the item in column 1 of data, excluding resp_id).
type
Type of DCM to estimate. Must be one of "lcdm", "dina", "dino", or "crum".
max_interaction
If type = "lcdm", the highest level of interaction to estimate. The default is to estimate all possible interactions. For example, an item that measures 4 attributes would have 4 main effects, 6 two-way interactions, 4 three-way interactions, and 1 four-way interaction. Setting max_interaction = 2 would result in only estimating the main effects and two-way interactions, excluding the three- and four- way interactions.
attribute_structure
Structural model specification. Must be one of "unconstrained" or "independent". "unconstrained" makes no assumptions about the relationships between attributes, whereas "independent" assumes that proficiency statuses on attributes are independent of each other.
method
Estimation method. Options are "variational", which uses Stan's variational algorithm; "mcmc", which uses Stan's sampling method; or "optim", which uses Stan's optimizer.
prior
A [dcmstan:prior]prior object. If NULL, default priors are used, as specified by [dcmstan:default_dcm_priors]dcmstan::default_dcm_priors().
backend
Character string naming the package to use as the backend for fitting the Stan model. Options are "rstan" (the default) or "cmdstanr". Can be set globally for the current R session via the "measr.backend" option (see [=options]options()). Details on the rstan and cmdstanr packages are available at https://mc-stan.org/rstan/ and https://mc-stan.org/cmdstanr/, respectively.
file
Either NULL (the default) or a character string. If a character string, the fitted model object is saved as an .rds object using [=saveRDS]saveRDS() using the supplied character string. The .rds extension is automatically added. If the specified file already exists, measr will load the previously saved model. Unless file_refit is specified, the model will not be refit.
file_refit
Controls when a saved model is refit. Options are "never", "always", and "on_change". Can be set globally for the current R session via the "measr.file_refit" option (see [=options]options()). For "never" (the default), the fitted model is always loaded if the file exists, and model fitting is skipped. For "always", the model is always refitted, regardless of whether or not file exists. For "on_change", the model will be refit if the data, prior, or method specified are different from that in the saved file.
...
Additional arguments passed to Stan. For backend = "rstan", arguments are passed to [rstan:stanmodel-method-sampling]rstan::sampling() or [rstan:stanmodel-method-optimizing]rstan::optimizing(). For backend = "cmdstanr", arguments are passed to the https://mc-stan.org/cmdstanr/reference/model-method-sample.htmlsample or https://mc-stan.org/cmdstanr/reference/model-method-optimize.htmloptimize methods of the https://mc-stan.org/cmdstanr/reference/CmdStanModel.htmlCmdStanModel class.
Value
A measrdcm object.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_mdm_lcdm <- measr_dcm( data = mdm_data, missing = NA, qmatrix = mdm_qmatrix, resp_id = "respondent", item_id = "item", type = "lcdm", method = "optim", seed = 63277, backend = "rstan" ) \) # examplesIf
measr_examples
Determine if code is executed interactively or in pkgdown
CRAN · 2.0.1 · measr/man/measr_examples.Rd · 2026-05-07

Used for determining examples that shouldn't be run on CRAN, but can be run for the pkgdown website.

Aliases
measr_examples
Usage
measr_examples()
Value
A logical value indicating whether or not the examples should be run.
Examples
measr_examples()
measr_extract
Extract components of a measrfit object
CRAN · 2.0.1 · measr/man/measr_extract.Rd · 2026-05-07

Extract model metadata, parameter estimates, and model evaluation results.

Aliases
measr_extract
Concepts
BradshawGoodmanSinharayTemplin
Usage
measr_extract(model, what, ...)
Arguments
model
The estimated to extract information from.
what
Character string. The information to be extracted. See details for available options.
...
Additional arguments passed to each extract method. ppmc_interval: For what = "odds_ratio_flags" and what = "conditional_prob_flags", the compatibility interval used for determining model fit flags to return. For example, a ppmc_interval of 0.95 (the default) will return any PPMCs where the posterior predictive p-value (ppp) is less than 0.025 or greater than 0.975. agreement: For what = "classification_reliability", additional measures of agreement to include. By default, the classification accuracy and consistency metrics defined Johnson & Sinharay (2018) are returned. Additional metrics that can be specified to agreement are Goodman & Kruskal's lambda (lambda), Cohen's kappa (kappa), Youden's statistic (youden), the tetrachoric correlation (tetra), true positive rate (tp), and the true negative rate (tn). For what = "probability_reliability", additional measures of agreement to include. By default, the informational reliability index defined by Johnson & Sinharay (2020) is returned. Additional metrics that can be specified to agreement are the point biserial reliability index (bs), parallel forms reliability index (pf), and the tetrachoric reliability index (tb), which was originally defined by Templin & Bradshaw (2013).
Details
For diagnostic classification models, we can extract the following information: Model metadata prior: The priors used when estimating the model. classes: The possible classes or profile patterns. This will show the class label (i.e., the pattern of proficiency) and the attributes included in each class. Estimated model components Model parameters item_param: The estimated item parameters. This shows the name of the parameter, the class of the parameter, and the estimated value. strc_param: The estimated structural parameters. This is the base rate of membership in each class. This shows the class pattern, the attributes present in each class, and the estimated proportion of respondents in each class. attribute_base_rate: The estimated base rate of attribute proficiency. Calculated from the structural parameters of the classes where each attribute is present. pi_matrix: The model estimated probability that a respondent in the given class provides a correct response to the item. The output shows the the item (rows), class (columns), and estimated p-values. exp_pvalues: Model expected p-values for each item. This is equivalent to the pi_matrix, but also includes an "overall" field, which represents the expected p-value for each item (i.e., an average of the class-specific p-values, weighted by the prevalence of each class). Respondent results class_prob: The probability that each respondent belongs to class (i.e., has the given pattern of proficiency). attribute_prob: The proficiency probability for each respondent and attribute. Model fit Absolute model fit m2: The htmlM<sub>2</sub>M_2 fit statistic. See [=fit_m2]fit_m2() for details. rmsea: The root mean square error of approximation (RMSEA) fit statistic and associated confidence interval. See [=fit_m2]fit_m2() for details. srmsr: The standardized root mean square residual (SRMSR) fit statistic. See [=fit_m2]fit_m2() for details. ppmc_raw_score: The observed and posterior predicted chi-square statistic for the raw score distribution. See [=fit_ppmc]fit_ppmc() for details. ppmc_conditional_prob: The observed and posterior predicted conditional probabilities of each class providing a correct response to each item. See [=fit_ppmc]fit_ppmc() for details. ppmc_conditional_prob_flags: A subset of the PPMC conditional probabilities where the ppp is outside the specified ppmc_interval. ppmc_odds_ratio: The observed and posterior predicted odds ratios of each item pair. See [=fit_ppmc]fit_ppmc() for details. ppmc_odds_ratio_flags: A subset of the PPMC odds ratios where the ppp is outside the specified ppmc_interval. ppmc_pvalue: The observed and posterior predicted proportion of correct responses to each item. See [=fit_ppmc]fit_ppmc() for details. ppmc_pvalue_flags: A subset of the PPMC proportion correct values where the ppp is outside the specified ppmc_interval. Relative model fit loo: The leave-one-out cross validation results. See [loo:loo]loo::loo() for details. waic: The widely applicable information criterion results. See [loo:waic]loo::waic() for details. aic: The Akaike information criterion results. See [=aic]aic() for details. bic: The Bayesian information criterion results. See [=bic]bic() for details. Reliability pattern_reliability: The accuracy and consistency of the overall attribute profile classification, as described by Cui et al. (2012). classification_reliability: The classification accuracy and consistency for each attribute, using the metrics described by Johnson & Sinharay (2018). probability_reliability: Reliability estimates for the probability of proficiency on each attribute, as described by Johnson & Sinharay (2020).
Value
The extracted information. The specific structure will vary depending on what is being extracted, but usually the returned object is a [tibble:tibble-package]tibble with the requested information.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_mdm_lcdm <- dcm_estimate( dcm_specify(dcmdata::mdm_qmatrix, identifier = "item"), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "optim", seed = 63277, backend = "rstan" ) measr_extract(rstn_mdm_lcdm, "strc_param") \) # examplesIf
References
Cui, Y., Gierl, M. J., & Chang, H.-H. (2012). Estimating classification consistency and accuracy for cognitive diagnostic assessment. Journal of Educational Measurement, 49(1), 19-38. 10.1111/j.1745-3984.2011.00158.x Johnson, M. S., & Sinharay, S. (2018). Measures of agreement to assess attribute-level classification accuracy and consistency for cognitive diagnostic assessments. Journal of Educational Measurement, 55(4), 635-664. 10.1111/jedm.12196 Johnson, M. S., & Sinharay, S. (2020). The reliability of the posterior probability of skill attainment in diagnostic classification models. Journal of Educational and Behavioral Statistics, 45(1), 5-31. 10.3102/1076998619864550 Templin, J., & Bradshaw, L. (2013). Measuring the reliability of diagnostic classification model examinee estimates. Journal of Classification, 30(2), 251-275. 10.1007/s00357-013-9129-4
measrdcm
S7 class for measrdcm objects
CRAN · 2.0.1 · measr/man/measrdcm.Rd · 2026-05-07

The measrdcm constructor is exported to facilitate the conversion of other model objects (e.g., stanfit) to measrdcm objects. We do not expect or recommend calling this function directly, unless you are creating a method for converting to measrdcm. Rather, to create a measrdcm object, one should use [=dcm_estimate]dcm_estimate().

Aliases
measrdcm
Concepts
Stan
Usage
measrdcm( model_spec = NULL, data = list(), stancode = character(0), method = stanmethod(), algorithm = character(0), backend = stanbackend(), model = list(), respondent_estimates = list(), fit = list(), criteria = list(), reliability = list(), file = character(0), version = list() )
Arguments
model_spec
The model specification used to estimate the model.
data
The data used to estimate the model.
stancode
The model code in Stan language.
method
The method used to fit the model.
algorithm
The name of the algorithm used to fit the model.
backend
The name of the backend used to fit the model.
model
The fitted Stan model. This will object of class [rstan:stanfit-class]rstan::stanfit if backend = "rstan" and [cmdstanr:CmdStanMCMC]CmdStanMCMC if backend = "cmdstanr" was specified when fitting the model.
respondent_estimates
An empty list for adding estimated person parameters after fitting the model.
fit
An empty list for adding model fit information after fitting the model.
criteria
An empty list for adding information criteria after fitting the model.
reliability
An empty list for adding reliability information after fitting the model.
file
Optional name of a file which the model objects was saved to or loaded from.
version
The versions of measr, Stan, and rstan or cmdstanr that were used to fit the model.
Value
A measrdcm object.
Examples
qmatrix <- tibble::tibble( att1 = sample(0:1, size = 15, replace = TRUE), att2 = sample(0:1, size = 15, replace = TRUE), att3 = sample(0:1, size = 15, replace = TRUE), att4 = sample(0:1, size = 15, replace = TRUE) ) spec <- dcm_specify(qmatrix = qmatrix) measrdcm(spec)
See also
[=dcm_estimate]dcm_estimate().
model_evaluation
Add model evaluation metrics model objects
CRAN · 2.0.1 · measr/man/model_evaluation.Rd · 2026-05-07

Add model evaluation metrics to fitted model objects. These functions are wrappers around other functions that compute the metrics. The benefit of using these wrappers is that the model evaluation metrics are saved as part of the model object so that time-intensive calculations do not need to be repeated. See Details for specifics.

Aliases
model_evaluationadd_criterionadd_reliabilityadd_fitadd_respondent_estimates
Usage
add_criterion( x, criterion = c("loo", "waic", "log_mll", "aic", "bic"), overwrite = FALSE, save = TRUE, ..., r_eff = NA ) add_reliability(x, overwrite = FALSE, save = TRUE, ...) add_fit( x, method = c("m2", "ppmc"), ndraws = NULL, return_draws = ndraws, overwrite = FALSE, save = TRUE, ..., ci = 0.9 ) add_respondent_estimates( x, probs = c(0.025, 0.975), overwrite = FALSE, save = TRUE )
Arguments
x
A [=dcm_estimate]measrdcm object.
criterion
A vector of information criteria to calculate and add to the model object. Must be "loo", "waic", or "log_mll" for models estimated with MCMC, or "aic" or "bic" for models estimated with the optimizer.
overwrite
Logical. Indicates whether specified elements that have already been added to the estimated model should be overwritten. Default is FALSE.
save
Logical. Only relevant if a file was specified in the [=dcm_estimate]measrdcm object passed to x. If TRUE (the default), the model is re-saved to the specified file when new criteria are added to the R object. If FALSE, the new criteria will be added to the R object, but the saved file will not be updated.
...
Arguments passed on to [=fit_ppmc]fit_ppmc model_fitThe posterior predictive model checks to compute for an evaluation of model-level fit. If NULL, no model-level checks are computed. See details. item_fitThe posterior predictive model checks to compute for an evaluation of item-level fit. If NULL, no item-level checks are computed. See details.
r_eff
Vector of relative effective sample size estimates for the likelihood (exp(log_lik)) of each observation. This is related to the relative efficiency of estimating the normalizing term in self-normalized importance sampling when using posterior draws obtained with MCMC. If MCMC draws are used and r_eff is not provided then the reported PSIS effective sample sizes and Monte Carlo error estimates can be over-optimistic. If the posterior draws are (near) independent then r_eff=1 can be used. r_eff has to be a scalar (same value is used for all observations) or a vector with length equal to the number of observations. The default value is 1. See the [loo:relative_eff]relative_eff() helper functions for help computing r_eff.
method
A vector of model fit methods to evaluate and add to the model object.
ndraws
The number of posterior draws to base the checks on. Must be less than or equal to the total number of posterior draws retained in the estimated model. If NULL (the default) the total number from the estimated model is used.
return_draws
Number of posterior draws for each specified fit statistic to be returned. This does not affect the calculation of the posterior predictive checks, but can be useful for visualizing the fit statistics. Must be less than ndraws (or the total number of draws if ndraws = NULL). If 0 (the default), only summaries of the posterior are returned (no individual samples).
ci
The confidence interval for the RMSEA, computed from the M2
probs
The percentiles to be computed by the [stats:quantile]stats::quantile() function. Only relevant if the model was estimated with a method that results in posterior distributions (e.g., "mcmc", "variational"). Only used if summary is TRUE.
Details
For add_respondent_estimates(), estimated person parameters are added to the @respondent_estimates element of the fitted model. For add_fit(), model and item fit information are added to the @fit element of the fitted model. This function wraps [=fit_m2]fit_m2() to calculate the htmlM<sub>2</sub>M_2 statistic (Hansen et al., 2016; Liu et al., 2016) and/or [=fit_ppmc]fit_ppmc() to calculate posterior predictive model checks (Park et al., 2015; Sinharay & Almond, 2007; Sinharay et al., 2006; Thompson, 2019), depending on which methods are specified. For add_criterion(), relative fit criteria are added to the @criteria element of the fitted model. For models estimated with MCMC, this function wraps [=loo]loo() or [=waic]waic() to calculate the LOO-CV (Vehtari et al., 2017) or WAIC (Watanabe, 2010), respectively, or [=log_mll]log_mll() to calculate the log marginal likelihood, which is used for calculating Bayes factors. For models estimated with the optimizer, this wraps [=aic]aic() or [=bic]bic() to estimate the AIC (Akaike, 1973) or BIC (Schwarz, 1978), respectively. For add_reliability(), reliability information is added to the @reliability element of the fitted model. Pattern level reliability is described by Cui et al. (2012). Classification reliability and posterior probability reliability are described by Johnson & Sinharay (2018, 2020), respectively. This function wraps [=reliability]reliability(). Arguments supplied to ... are passed to [=reliability]reliability().
Value
A modified [=dcm_estimate]measrdcm object with the corresponding slot populated with the specified information.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf cmds_mdm_dina <- dcm_estimate( dcm_specify( dcmdata::mdm_qmatrix, identifier = "item", measurement_model = dina(), priors = c( prior(beta(5, 17), type = "slip"), prior(beta(5, 17), type = "guess") ) ), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "optim", seed = 63277, backend = "rstan" ) cmds_mdm_dina <- add_reliability(cmds_mdm_dina) cmds_mdm_dina <- add_fit(cmds_mdm_dina, method = "m2") cmds_mdm_dina <- add_respondent_estimates(cmds_mdm_dina) \) # examplesIf
References
Akaike, H. (1973). Information theory and an extension of the maximum likelihood principle. In B. N. Petrov & F. Csáki (Eds.), Proceedings of the Second International Symposium on Information Theory (pp. 267-281). Akademiai Kiado. Cui, Y., Gierl, M. J., & Chang, H.-H. (2012). Estimating classification consistency and accuracy for cognitive diagnostic assessment. Journal of Educational Measurement, 49(1), 19-38. 10.1111/j.1745-3984.2011.00158.x Hansen, M., Cai, L., Monroe, S., & Li, Z. (2016). Limited-information goodness-of-fit testing of diagnostic classification item response models. British Journal of Mathematical and Statistical Psychology, 69(3), 225-252. 10.1111/bmsp.12074 Johnson, M. S., & Sinharay, S. (2018). Measures of agreement to assess attribute-level classification accuracy and consistency for cognitive diagnostic assessments. Journal of Educational Measurement, 55(4), 635-664. 10.1111/jedm.12196 Johnson, M. S., & Sinharay, S. (2020). The reliability of the posterior probability of skill attainment in diagnostic classification models. Journal of Educational and Behavioral Statistics, 45(1), 5-31. 10.3102/1076998619864550 Liu, Y., Tian, W., & Xin, T. (2016). An application of htmlM<sub>2</sub>M_2 statistic to evaluate the fit of cognitive diagnostic models. Journal of Educational and Behavioral Statistics, 41(1), 3-26. 10.3102/1076998615621293 Park, J. Y., Johnson, M. S., Lee, Y-S. (2015). Posterior predictive model checks for cognitive diagnostic models. International Journal of Quantitative Research in Education, 2(3-4), 244-264. 10.1504/IJQRE.2015.071738 Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6(2), 461–464. 10.1214/aos/1176344136 Sinharay, S., & Almond, R. G. (2007). Assessing fit of cognitive diagnostic models. Educational and Psychological Measurement, 67(2), 239-257. 10.1177/0013164406292025 Sinharay, S., Johnson, M. S., & Stern, H. S. (2006). Posterior predictive assessment of item response theory models. Applied Psychological Measurement, 30(4), 298-321. 10.1177/0146621605285517 Thompson, W. J. (2019). Bayesian psychometrics for diagnostic assessments: A proof of concept (Research Report No. 19-01). University of Kansas; Accessible Teaching, Learning, and Assessment Systems. 10.35542/osf.io/jzqs8 Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5), 1413-1432. 10.1007/s11222-016-9696-4 Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and widely applicable information criterion in singular learning theory. Journal of Machine Learning Research, 11(116), 3571-3594. https://jmlr.org/papers/v11/watanabe10a.html
qmatrix_validation
Q-matrix validation
CRAN · 2.0.1 · measr/man/qmatrix_validation.Rd · 2026-05-07

Calculate Q-matrix validation metrics for a fitted model objects using methods described by de la Torre and Chiu (2016). See details for additional information.

Aliases
qmatrix_validation
Concepts
ChiuTorre
Usage
qmatrix_validation(x, ..., pvaf_threshold = 0.95)
Arguments
x
A [=dcm_estimate]measrdcm object.
...
Unused.
pvaf_threshold
The threshold for proportion of variance accounted for to flag items for appropriate empirical specifications. The default is .95 as implemented by de la Torre and Chiu (2016).
Details
Q-matrix validation is conducted by evaluating the proportion of variance accounted for by different Q-matrix specifications. Following the method described by de la Torre and Chiu (2016), we use the following steps for each item: Calculate the total variance explained if an item measured all possible attributes. For each possible Q-matrix entry, calculate the variance explained if the item measured the given attributes. Calculate the proportion of variance explained (PVAF) as the variance explained by the current Q-matrix entry divided by the variance explained by the saturated entry (Step 1). After computing the PVAF for all possible Q-matrix entries, filter to only those with a PVAF greater than the specified pvaf_threshold threshold. Filter the remaining Q-matrix entries to those that measure the fewest number of attributes (i.e., we prefer a more parsimonious model). If there is more than one Q-matrix entry remaining, select the entry with the highest PVAF.
Value
A [tibble:tibble-package]tibble containing the Q-matrix validation results. There is one row per item with 5 columns: The item identifier, as specified in the Q-matrix and used to estimate the model. original_specification: The original Q-matrix entry for the item. original_pvaf: The proportion of variance accounted for by the original specification, compared to a specification where the item measures all attributes. empirical_specification: The Q-matrix specification that measures the fewest attributes with a proportion of variance accounted for over the the specified pvaf_threshold threshold. If the original specification is optimal, empirical_specification will be NA. empirical_pvaf: The proportion of variance accounted for by the empirical specification, compared to a specification where the item measures all attributes. If the original specification is optimal, emprirical_pvaf will be NA.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf mod_spec <- dcm_specify( qmatrix = dcmdata::ecpe_qmatrix, identifier = "item_id", measurement_model = dcmstan::lcdm(), structural_model = dcmstan::hdcm( hierarchy = "lexical -> cohesive -> morphosyntactic" ) ) rstn_ecpe <- dcm_estimate( mod_spec, data = dcmdata::ecpe_data, identifier = "resp_id", backend = "rstan", method = "optim" ) q_matrix_validation <- qmatrix_validation(rstn_ecpe) \) # examplesIf
References
de la Torre, J., & Chiu, C.-Y. (2016). A general method of empirical Q-matrix validation. Psychometrika, 81(2), 253-273. 10.1007/s11336-015-9467-8
reexports
Objects exported from other packages
CRAN · 2.0.1 · import · measr/man/reexports.Rd · 2026-05-07

These objects are imported from other packages. Follow the links below to see their documentation. dcm2[dcm2]fit_m2 dcmstan[dcmstan:structural-model]bayesnet, [dcmstan]create_profiles, [dcmstan:measurement-model]crum, [dcmstan]dcm_specify, [dcmstan]default_dcm_priors, [dcmstan:measurement-model]dina, [dcmstan:measurement-model]dino, [dcmstan]get_parameters, [dcmstan:structural-model]hdcm, [dcmstan:structural-model]independent, [dcmstan:measurement-model]lcdm, [dcmstan:structural-model]loglinear, [dcmstan:measurement-model]ncrum, [dcmstan:measurement-model]nida, [dcmstan:measurement-model]nido, [dcmstan]prior, [dcmstan:structural-model]unconstrained loo[loo]loo, [loo]loo_compare, [loo]waic posterior[posterior:draws]as_draws, [posterior:rvar-summaries-over-draws]E, [posterior:rvar-summaries-over-draws]Pr, [posterior:rvar-summaries-within-draws]rvar_mad, [posterior:rvar-summaries-within-draws]rvar_max, [posterior:rvar-summaries-within-draws]rvar_mean, [posterior:rvar-summaries-within-draws]rvar_median, [posterior:rvar-summaries-within-draws]rvar_min, [posterior:rvar-summaries-within-draws]rvar_prod, [posterior:rvar-summaries-within-draws]rvar_sd, [posterior:rvar-summaries-within-draws]rvar_sum, [posterior:rvar-summaries-within-draws]rvar_var

Aliases
reexportsdcm_specifycreate_profilesget_parameterspriordefault_dcm_priorslcdmdinadinonidanidoncrumcrumunconstrainedindependentloglinearhdcmbayesnetEPrrvar_medianrvar_sumrvar_prodrvar_minrvar_maxrvar_meanrvar_sdrvar_varrvar_madloowaicloo_comparefit_m2as_draws
Keywords
internal
reliability
Estimate the reliability of a diagnostic classification model
CRAN · 2.0.1 · measr/man/reliability.Rd · 2026-05-07

For diagnostic classification models, reliability can be estimated at the pattern or attribute level. Pattern-level reliability represents the classification consistency and accuracy of placing students into an overall mastery profile. Rather than an overall profile, attributes can also be scored individually. In this case, classification consistency and accuracy should be evaluated for each individual attribute, rather than the overall profile. This is referred to as the maximum a posteriori (MAP) reliability. Finally, it may be desirable to report results as the probability of proficiency or mastery on each attribute instead of a proficient/not proficient classification. In this case, the reliability of the posterior probability should be reported. This is the expected a posteriori (EAP) reliability.

Aliases
reliability
Usage
reliability(x, ..., threshold = 0.5, force = FALSE)
Arguments
x
The estimated model to be evaluated.
...
Unused. For future extensions.
threshold
For map_reliability, the threshold applied to the attribute-level probabilities for determining the binary attribute classifications. Should be a numeric vector of length 1 (the same threshold is applied to all attributes), or length equal to the number of attributes. If a named vector is supplied, names should match the attribute names in the Q-matrix used to estimate the model. If unnamed, thresholds should be in the order the attributes were defined in the Q-matrix.
force
If reliability information has already been added to the model object with [=add_reliability]add_reliability(), should it be recalculated. Default is FALSE.
Details
The pattern-level reliability (pattern_reliability) statistics are described in Cui et al. (2012). Attribute-level classification reliability statistics (map_reliability) are described in Johnson & Sinharay (2018). Reliability statistics for the posterior mean of the skill indicators (i.e., the mastery or proficiency probabilities; eap_reliability) are described in Johnson & Sinharay (2019).
Value
For class measrdcm, a list with 3 elements: pattern_reliability: The pattern-level accuracy (p_a) and consistency (p_c) described by Cui et al. (2012). map_reliability: A list with 2 elements: accuracy and consistency, which include the attribute-level classification reliability statistics described by Johnson & Sinharay (2018). eap_reliability: The attribute-level posterior probability reliability statistics described by Johnson & Sinharay (2020).
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_mdm_lcdm <- dcm_estimate( dcm_specify(dcmdata::mdm_qmatrix, identifier = "item"), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "optim", seed = 63277, backend = "rstan" ) reliability(rstn_mdm_lcdm) \) # examplesIf
References
Cui, Y., Gierl, M. J., & Chang, H.-H. (2012). Estimating classification consistency and accuracy for cognitive diagnostic assessment. Journal of Educational Measurement, 49(1), 19-38. 10.1111/j.1745-3984.2011.00158.x Johnson, M. S., & Sinharay, S. (2018). Measures of agreement to assess attribute-level classification accuracy and consistency for cognitive diagnostic assessments. Journal of Educational Measurement, 55(4), 635-664. 10.1111/jedm.12196 Johnson, M. S., & Sinharay, S. (2020). The reliability of the posterior probability of skill attainment in diagnostic classification models. Journal of Educational and Behavioral Statistics, 45(1), 5-31. 10.3102/1076998619864550
score
Posterior draws of respondent proficiency
CRAN · 2.0.1 · measr/man/score.Rd · 2026-05-07

Calculate posterior draws of respondent proficiency. Optionally retain all posterior draws or return only summaries of the distribution for each respondent.

Aliases
score
Usage
score( x, newdata = NULL, missing = NA, identifier = NULL, summary = TRUE, probs = c(0.025, 0.975), force = FALSE )
Arguments
x
An estimated model (e.g., from [=dcm_estimate]dcm_estimate().
newdata
Optional new data. If not provided, the data used to estimate the model is scored. If provided, newdata should be a data frame with 1 row per respondent and 1 column per item. All items that appear in newdata should appear in the data used to estimate x.
missing
An R expression specifying how missing data in data is coded (e.g., NA, ".", -99, etc.). The default is NA.
identifier
Optional. Variable name of a column in newdata that contains respondent identifiers. NULL (the default) indicates that no identifiers are present in the data, and row numbers will be used as identifiers. If newdata is not specified and the data used to estimate the model is scored, the resp_id is taken from the original data.
summary
Should summary statistics be returned instead of the raw posterior draws? Only relevant if the model was estimated with a method that results in posterior distributions (e.g., "mcmc", "variational"). Default is FALSE.
probs
The percentiles to be computed by the [stats:quantile]stats::quantile() function. Only relevant if the model was estimated with a method that results in posterior distributions (e.g., "mcmc", "variational"). Only used if summary is TRUE.
force
If respondent estimates have already been added to the model object with [=add_respondent_estimates]add_respondent_estimates(), should they be recalculated. Default is FALSE.
Value
A list with two elements: class_probabilities and attribute_probabilities. If summary is FALSE, each element is a tibble with one row per respondent. The columns include the respondent identifier, and one column of probabilities for each of the possible classes or attributes (as [posterior:rvar]posterior::rvar() objects). If summary is TRUE, each element is a tibble with one row per respondent and class or attribute. The columns include the respondent identifier, class or attribute, mean, and one column for every value specified in probs.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf rstn_mdm_lcdm <- dcm_estimate( dcm_specify(dcmdata::mdm_qmatrix, identifier = "item"), data = dcmdata::mdm_data, missing = NA, identifier = "respondent", method = "optim", seed = 63277, backend = "rstan" ) score(rstn_mdm_lcdm, summary = FALSE) \) # examplesIf
stan-classes
S7 classes for estimation specifications
CRAN · 2.0.1 · measr/man/stan-classes.Rd · 2026-05-07

The constructors for Stan back-ends and methods are exported to support extensions to measr, for example converting other models to measrfit objects. We do not expect or recommend calling these functions directly unless you are converting objects, or creating new methods for measrfit objects.

Aliases
stan-classesrstancmdstanrmcmcoptimvariationalpathfindergqs
Usage
rstan() cmdstanr() mcmc() optim() variational() pathfinder() gqs()
Details
Back-end classes There are two classes for estimation backends, which define the package that should be used, or was used, to estimate a model. Both classes inherit from measr::stanbackend. The rstan() class indicates use of the rstan package. cmdstanr() indicates use of the cmdstanr package. Method classes The method classes define which estimation method should be used, or was used, for a model. All method classes inherit from measr::stanmethod. The mcmc() class indicates the use of Markov chain Monte Carlo via [rstan:stanmodel-method-sampling]rstan::sampling() when using rstan or the [cmdstanr:model-method-sample]$sample() method of the [cmdstanr:CmdStanModel]CmdStanModel class when using cmdstanr. The variational() class indicated the use of Stan's variational algorithm for approximate posterior sampling via [rstan:stanmodel-method-vb]rstan::vb() when using rstan or the [cmdstanr:model-method-variational]$variational() method of the [cmdstanr:CmdStanModel]CmdStanModel class when using cmdstanr. The pathfinder() class indicates the use of pathfinder variational inference algorithm via the [cmdstanr:model-method-pathfinder]$pathfinder() method of the [cmdstanr:CmdStanModel]CmdStanModel. This method is only available when using cmdstanr. The optim() class indicates the use maximum-likelihood via [rstan:stanmodel-method-optimizing]rstan::optimizing() when using rstan or the [cmdstanr:model-method-optimize]$optimize() method of the [cmdstanr:CmdStanModel]CmdStanModel class when using cmdstanr. Finally, there is a gqs() class for use when a model has previously been estimated and were are interested in calculating generated quantities (e.g., [=score]score(), [=loglik_array]loglik_array()). The gqs() class indicates the use of [rstan:stanmodel-method-gqs]rstan::gqs() when using rstan and the [cmdstanr:model-method-generate-quantities]$generate_quantities() method of the [cmdstanr:CmdStanModel]CmdStanModel class when using cmdstanr.
Value
An [S7:S7_object]S7 object with the corresponding class.
Examples
rstan() mcmc()
tidyeval
Tidy eval helpers
CRAN · 2.0.1 · measr/man/tidyeval.Rd · 2026-05-07

This page lists the tidy eval tools reexported in this package from rlang. To learn about using tidy eval in scripts and packages at a high level, see the https://dplyr.tidyverse.org/articles/programming.htmldplyr programming vignette and the https://ggplot2.tidyverse.org/articles/ggplot2-in-packages.htmlggplot2 in packages vignette. The https://adv-r.hadley.nz/metaprogramming.htmlMetaprogramming section of https://adv-r.hadley.nzAdvanced R may also be useful for a deeper dive. The tidy eval operators \\, !!, and !!! are syntactic constructs which are specially interpreted by tidy eval functions. You will mostly need \\, as !! and !!! are more advanced operators which you should not have to use in simple cases. The curly-curly operator \\ allows you to tunnel data-variables passed from function arguments inside other tidy eval functions. \\ is designed for individual arguments. To pass multiple arguments contained in dots, use ... in the normal way. html<div class="sourceCode">my_function <- function(data, var, ...) \ data |> group_by(...) |> summarise(mean = mean(\\ var \\)) \ html</div> [=enquo]enquo() and [=enquos]enquos() delay the execution of one or several function arguments. The former returns a single expression, the latter returns a list of expressions. Once defused, expressions will no longer evaluate on their own. They must be injected back into an evaluation context with !! (for a single expression) and !!! (for a list of expressions). html<div class="sourceCode">my_function <- function(data, var, ...) \ # Defuse var <- enquo(var) dots <- enquos(...) # Inject data |> group_by(!!!dots) |> summarise(mean = mean(!!var)) \ html</div> In this simple case, the code is equivalent to the usage of \\ and ... above. Defusing with enquo() or enquos() is only needed in more complex cases, for instance if you need to inspect or modify the expressions in some way. The .data placeholder is an object that represents the current slice of data. If you have a variable name in a string, use the .data placeholder to subset that variable with [[. html<div class="sourceCode">my_var <- "disp" mtcars |> summarise(mean = mean(.data[[my_var]])) html</div> Another tidy eval operator is :=. It makes it possible to use glue and curly-curly syntax on the LHS of =. For technical reasons, the R language doesn't support complex expressions on the left of =, so we use := as a workaround. html<div class="sourceCode">my_function <- function(data, var, suffix = "foo") \ # Use `\\` to tunnel function arguments and the usual glue # operator `\` to interpolate plain strings. data |> summarise("\\ var \\_mean_\suffix\" := mean(\\ var \\)) \ html</div> Many tidy eval functions like dplyr::mutate() or dplyr::summarise() give an automatic name to unnamed inputs. If you need to create the same sort of automatic names by yourself, use as_label(). For instance, the glue-tunnelling syntax above can be reproduced manually with: html<div class="sourceCode">my_function <- function(data, var, suffix = "foo") \ var <- enquo(var) prefix <- as_label(var) data |> summarise("\prefix\_mean_\suffix\" := mean(!!var)) \ html</div> Expressions defused with enquo() (or tunnelled with \\) need not be simple column names, they can be arbitrarily complex. as_label() handles those cases gracefully. If your code assumes a simple column name, use as_name() instead. This is safer because it throws an error if the input is not a name as expected.

Aliases
tidyevalenquoenquos.data:=as_nameas_label
Keywords
internal
Value
See documentation for specific functions in [rlang:rlang-package]rlang.
yens_q3
Yen's htmlQ<sub>3</sub>Q_3 statistic for local item dependence
CRAN · 2.0.1 · measr/man/yens_q3.Rd · 2026-05-07

Calculate the htmlQ<sub>3</sub>Q_3 statistic to evaluate the assumption of independent items.

Aliases
yens_q3
Concepts
ChenThissen
Usage
yens_q3(x, ..., crit_value = 0.2, summary = NULL)
Arguments
x
A [=dcm_estimate]measrdcm object.
...
Unused.
crit_value
The critical value threshold for flagging the residual correlation of a given item pair. The default is 0.2, as described by Chen and Thissen (1997).
summary
A summary statistic to be returned. Must be one of "q3max" or "q3star" (see Details). If NULL (the default), no summary statistic is return, and all residual correlations are returned.
Details
Psychometric models assume that items are independent of each other, conditional on the latent trait. The htmlQ<sub>3</sub>Q_3 statistic (Yen, 1984) is used to evaluate this assumption. For each observed item response, we calculate the residual between the model predicted score and the observed score and then estimate correlations between the residuals across items. Each residual correlation is a htmlQ<sub>3</sub>Q_3 statistic. Often, a critical values is used to flag a residual correlation above a given threshold (e.g., Chen & Thissen, 1997). Alternatively, we may use a summary statistic such as the maximum htmlQ<sub>3</sub>Q_3 statistic (htmlQ<sub>3,max</sub>Q_3,max; Christensen et al., 2017), or the mean-adjusted maximum htmlQ<sub>3</sub>Q_3 statistic (htmlQ<sub>3,*</sub>Q_3,*; Marais, 2013).
Value
If summary = NULL, a tibble with the residual correlation and flags for all item pairs. Otherwise, a numeric value representing the requested summary statistic.
Examples
if (measr_examples()) withAutoprint(\ # examplesIf model_spec <- dcm_specify( qmatrix = dcmdata::mdm_qmatrix, dentifier = "item" ) model <- dcm_estimate( dcm_spec = model_spec, data = dcmdata::mdm_data, identifier = "respondent", method = "optim", seed = 63277 ) yens_q3(model) \) # examplesIf
References
Chen, W.-H., & Thissen, D. (1997). Local dependence indexes for item pairs using item response theory. Journal of Educational and Behavioral Statistics, 22(3), 265-389. 10.3102/10769986022003265 Christensen, K. B., Makransky, G., & Horton, M. (2017). Critical values for Yen's Q3: Identification of local dependence in the Rasch model using residual correlations. Applied Psychological Measurement, 41(3), 178-194. 10.1177/0146621616677520 Marais, I. (2013). Local dependence. In K. B. Christensen, S. Kreiner, & M. Mesbah (Eds.), Rasch models in health (pp. 111-130). Wiley. Yen, W. M. (1984). Effects of local item dependence on the fit and equating performance of the three-parameter logistic model. Applied Psychological Measurement, 8(2), 125-145. 10.1177/014662168400800201

버전 이력

RepositoryVersionPublishedFirst seenLast seenDocs
CRAN2.0.12026-05-292026-05-30

보안

표시할 OSV 데이터가 없습니다.

문헌 신호

표시할 OpenAlex 데이터가 없습니다.