R 패키지 메타데이터와 수집 신호를 모아 봅니다.
첫 화면에서 판단해야 할 수집 신호를 먼저 배치합니다.
DESCRIPTION에서 감지한 backend 관련 package입니다.
기본 메타데이터를 작은 카드와 토큰으로 압축합니다.
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)| Package | Type | Spec |
|---|---|---|
| bridgesampling CRAN · 2.0.1 · 2026-05-30 | Imports | bridgesampling |
| cli CRAN · 2.0.1 · 2026-05-30 | Imports | cli |
| dcm2 CRAN · 2.0.1 · 2026-05-30 | Imports | dcm2 |
| dcmstan CRAN · 2.0.1 · 2026-05-30 | Imports | dcmstan (>= 0.1.0) |
| dplyr CRAN · 2.0.1 · 2026-05-30 | Imports | dplyr (>= 1.1.1) |
| dtplyr CRAN · 2.0.1 · 2026-05-30 | Imports | dtplyr |
| fs CRAN · 2.0.1 · 2026-05-30 | Imports | fs |
| glue CRAN · 2.0.1 · 2026-05-30 | Imports | glue |
| lifecycle CRAN · 2.0.1 · 2026-05-30 | Imports | lifecycle |
| loo CRAN · 2.0.1 · 2026-05-30 | Imports | loo |
| methods CRAN · 2.0.1 · 2026-05-30 | Imports | methods |
| posterior CRAN · 2.0.1 · 2026-05-30 | Imports | posterior |
| psych CRAN · 2.0.1 · 2026-05-30 | Imports | psych |
| Rcpp CRAN · 2.0.1 · 2026-05-30 | Imports | Rcpp (>= 0.12.0) |
| RcppParallel CRAN · 2.0.1 · 2026-05-30 | Imports | RcppParallel (>= 5.0.1) |
| rdcmchecks CRAN · 2.0.1 · 2026-05-30 | Imports | rdcmchecks (>= 0.1.1) |
| rlang CRAN · 2.0.1 · 2026-05-30 | Imports | rlang (>= 1.1.0) |
| rstan CRAN · 2.0.1 · 2026-05-30 | Imports | rstan (>= 2.26.0) |
| rstantools CRAN · 2.0.1 · 2026-05-30 | Imports | rstantools (>= 2.6.0) |
| S7 CRAN · 2.0.1 · 2026-05-30 | Imports | S7 |
| stats CRAN · 2.0.1 · 2026-05-30 | Imports | stats |
| tibble CRAN · 2.0.1 · 2026-05-30 | Imports | tibble |
| tidyr CRAN · 2.0.1 · 2026-05-30 | Imports | tidyr (>= 1.3.0) |
| BH CRAN · 2.0.1 · 2026-05-30 | LinkingTo | BH (>= 1.66.0) |
| Rcpp CRAN · 2.0.1 · 2026-05-30 | LinkingTo | Rcpp (>= 0.12.0) |
| RcppEigen CRAN · 2.0.1 · 2026-05-30 | LinkingTo | RcppEigen (>= 0.3.3.3.0) |
| RcppParallel CRAN · 2.0.1 · 2026-05-30 | LinkingTo | RcppParallel (>= 5.0.1) |
| rstan CRAN · 2.0.1 · 2026-05-30 | LinkingTo | rstan (>= 2.26.0) |
| StanHeaders CRAN · 2.0.1 · 2026-05-30 | LinkingTo | StanHeaders (>= 2.26.0) |
| cmdstanr CRAN · 2.0.1 · 2026-05-30 | Suggests | cmdstanr (>= 0.4.0) |
| dcmdata CRAN · 2.0.1 · 2026-05-30 | Suggests | dcmdata |
| knitr CRAN · 2.0.1 · 2026-05-30 | Suggests | knitr |
| rmarkdown CRAN · 2.0.1 · 2026-05-30 | Suggests | rmarkdown |
| roxygen2 CRAN · 2.0.1 · 2026-05-30 | Suggests | roxygen2 |
| spelling CRAN · 2.0.1 · 2026-05-30 | Suggests | spelling |
| testthat CRAN · 2.0.1 · 2026-05-30 | Suggests | testthat (>= 3.0.0) |
| withr CRAN · 2.0.1 · 2026-05-30 | Suggests | withr |
| 검색 결과가 없습니다. | ||
| Package | Type | Spec |
|---|---|---|
| 표시할 dependency edge가 없습니다. | ||
| 검색 결과가 없습니다. | ||
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}, }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 speciREADME 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.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 :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).
aic(x, ..., force = FALSE) bic(x, ..., force = FALSE)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) \) # examplesIfCalculate 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.
bayes_factor( x, ..., model_names = NULL, prior_prob = seq(0.02, 0.98, by = 0.02) )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") \) # examplesIfThe 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.
cdi(model, weight_prevalence = TRUE)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) \) # examplesIfEstimate 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).
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"), ... )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 ) \) # examplesIfFor 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.
fit_ppmc( x, ..., model_fit = NULL, item_fit = NULL, ndraws = NULL, probs = c(0.025, 0.975), return_draws = 0, force = FALSE )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") \) # examplesIfCalculate 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.
log_mll(x, ..., force = FALSE)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) \) # examplesIfThe 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.
loglik_array(model, ...)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) \) # examplesIfFor 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.
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)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).
fit_m2`measr::measrdcm`(model, ..., ci = 0.9, force = FALSE)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) \) # examplesIfhtmllogo.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.
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.
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"), ... )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" ) \) # examplesIfUsed for determining examples that shouldn't be run on CRAN, but can be run for the pkgdown website.
measr_examples()measr_examples()Extract model metadata, parameter estimates, and model evaluation results.
measr_extract(model, what, ...)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") \) # examplesIfThe 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().
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() )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)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.
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 )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) \) # examplesIfCalculate Q-matrix validation metrics for a fitted model objects using methods described by de la Torre and Chiu (2016). See details for additional information.
qmatrix_validation(x, ..., pvaf_threshold = 0.95)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) \) # examplesIfThese 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
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.
reliability(x, ..., threshold = 0.5, force = FALSE)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) \) # examplesIfCalculate posterior draws of respondent proficiency. Optionally retain all posterior draws or return only summaries of the distribution for each respondent.
score( x, newdata = NULL, missing = NA, identifier = NULL, summary = TRUE, probs = c(0.025, 0.975), force = FALSE )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) \) # examplesIfThe 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.
rstan() cmdstanr() mcmc() optim() variational() pathfinder() gqs()rstan() mcmc()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.
Calculate the htmlQ<sub>3</sub>Q_3 statistic to evaluate the assumption of independent items.
yens_q3(x, ..., crit_value = 0.2, summary = NULL)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| Repository | Version | Published | First seen | Last seen | Docs |
|---|---|---|---|---|---|
| CRAN | 2.0.1 | 2026-05-29 | 2026-05-30 |
표시할 OSV 데이터가 없습니다.
표시할 OpenAlex 데이터가 없습니다.