Skip to content

Commit

Permalink
Version 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo-Najera committed Jan 3, 2024
1 parent 42798bf commit 29ddbb6
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 16 deletions.
13 changes: 13 additions & 0 deletions .Rd2pdf860/Rd2.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
\nonstopmode{}
\documentclass[a4paper]{book}
\usepackage[times,inconsolata,hyper]{Rd}
\usepackage{makeidx}
\usepackage[utf8]{inputenc} % @SET ENCODING@
% \usepackage{graphicx} % @USE GRAPHICX@
\makeindex{}
\begin{document}
\chapter*{}
\begin{center}
{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{C:/Users/Usuario/OneDrive - Universidad Pontificia Comillas/Programación/GitHub/cdmTools} etc.}}
\par\bigskip{\large \today}
\end{center}
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.0.3
Date: 2023-03-30 13:39:41 UTC
SHA: b91779562fc4a44ee56fa282d810ecd52b095e5a
Version: 1.0.4
Date: 2023-11-14 14:30:10 UTC
SHA: ce3c3f87fc179f26bec0810d9a5ada0b58fec136
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: cdmTools
Type: Package
Title: Useful Tools for Cognitive Diagnosis Modeling
Version: 1.0.4
Date: 2023-11-14
Version: 1.0.5
Date: 2024-01-03
Authors@R: c(person(given = "Pablo", family = "Nájera", role = c("aut", "cre", "cph"), email = "[email protected]"), person(given = "Miguel A.", family = "Sorrel", role = c("aut", "cph"), email = "[email protected]"), person(given = "Francisco J.", family = "Abad", role = c("aut", "cph")), person(given = "Rodrigo S.", family = "Kreitchmann", role = c("ctb")), person(given = "Kevin", family = "Santos", role = c("ctb")))
Description: Provides useful tools for cognitive diagnosis modeling (CDM). The package includes functions for empirical Q-matrix estimation and validation, such as the Hull method (Nájera, Sorrel, de la Torre, & Abad, 2021, <doi:10.1111/bmsp.12228>) and the discrete factor loading method (Wang, Song, & Ding, 2018, <doi:10.1007/978-3-319-77249-3_29>). It also contains dimensionality assessment procedures for CDM, including parallel analysis and automated fit comparison as explored in Nájera, Abad, and Sorrel (2021, <doi:10.3389/fpsyg.2021.614470>). Other relevant methods and features for CDM applications, such as the restricted DINA model (Nájera et al., 2023; <doi:10.3102/10769986231158829>), the general nonparametric classification method (Chiu et al., 2018; <doi:10.1007/s11336-017-9595-4>), and corrected estimation of the classification accuracy via multiple imputation (Kreitchmann et al., 2022; <doi:10.3758/s13428-022-01967-5>) are also available. Lastly, the package provides some useful functions for CDM simulation studies, such as random Q-matrix generation and detection of complete/identified Q-matrices.
License: GPL-3
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ S3method(print,valQ)
export(CA.MI)
export(GNPC)
export(RDINA)
export(RDINA2GDINA)
export(estQ)
export(genQ)
export(is.Qid)
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# cdmTools 1.0.5
* Added - `RDINA2GDINA` function to increase compatibility with the `GDINA` package
* Changed - `CA.MI` and `personFit` have been updated to be compatible with `RDINA` objects
* Kevin Santos is included as a contributor

# cdmTools 1.0.4
* Changed - `is.Qid` has been updated to include new identifiability criteria
* Added - `personfit` function to identify aberrant response patterns
Expand All @@ -8,7 +13,7 @@

# cdmTools 1.0.2
* Added - `CA.MI` function to calculate corrected classification accuracy with multiple imputation
* Added - Rodrigo S. Kreitchmann as a contributor
* Rodrigo S. Kreitchmann is included as a contributor

# cdmTools 1.0.1
* Added - `GNPC` function to estimate attribute profiles
Expand Down
8 changes: 4 additions & 4 deletions R/CA.MI.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' The classification accuracy indices are the ones developed by Iaconangelo (2017) and Wang et al. (2015).
#' It is only applicable to dichotomous attributes. The function is built upon the \code{CA} function from the \code{GDINA} package (Ma & de la Torre, 2020).
#'
#' @param fit A G-DINA model fit object from the \code{GDINA} package (Ma & de la Torre, 2020).
#' @param fit An object of class \code{RDINA} or \code{GDINA} (Ma & de la Torre, 2020).
#' @param what What attribute estimates are used? The default is \code{"EAP"}.
#' @param R Number of bootstrap samples and imputations. The default is 500.
#' @param n.cores Number of processors to use to speed up multiple imputation. The default is 2.
Expand All @@ -19,7 +19,7 @@
#' \item{\code{CCM}}{Conditional classification matrix, see Iaconangelo (2017, p. 13) (\code{matrix}).}
#' }
#'
#' @author {Rodrigo S. Kreitchmann, Universidad Pontificia Comillas}
#' @author {Rodrigo S. Kreitchmann, Universidad Nacional de Educación a Distancia}
#'
#' @references
#' Iaconangelo, C.(2017). \emph{Uses of classification error probabilities in the three-step approach to estimating cognitive diagnosis models}. (Unpublished doctoral dissertation). New Brunswick, NJ: Rutgers University.
Expand All @@ -43,10 +43,10 @@
#' ca.mi <- CA.MI(fit)
#' ca.mi
#' }

CA.MI <- function(fit, what = "EAP", R = 500, n.cores = 1, verbose = TRUE, seed = NULL){

if(!inherits(fit, "GDINA")){stop("Error in CA.MI: fit must be of class 'GDINA'.")}
if(inherits(fit, "RDINA")){fit <- RDINA2GDINA(fit)}
if(!inherits(fit, "GDINA")){stop("Error in CA.MI: fit must be of class 'RDINA' or 'GDINA'.")}
if(!what %in% c("EAP", "MAP", "MLE")){stop("Error in CA.MI: what must be either 'EAP', 'MAP', or 'MLE'.")}
if(any(apply(fit$options$dat, 2, stats::sd, na.rm = TRUE) == 0)){stop("Error in CA.MI: The data must not contain constant responses for an item.")}
if((!is.numeric(R) & !is.double(R)) | length(R) > 1){stop("Error in CA.MI: R must be a unique numeric value.")}
Expand Down
53 changes: 53 additions & 0 deletions R/RDINA2GDINA.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#' Translate RDINA object into GDINA object
#'
#' @description This function translates an object of class \code{RDINA} to an object of class \code{GDINA}, so that the estimated R-DINA object is compatible with most of the functions in the \code{GDINA} package (Ma & de la Torre, 2020), including model fit, item fit, and Q-matrix validation.
#'
#' @param fit An object of class \code{RDINA}.
#'
#' @return \code{RDINA2GDINA} returns an object of class \code{GDINA}. See the \code{GDINA} package for more information.
#'
#' @author {Pablo Nájera, Universidad Pontificia Comillas}
#'
#' @references
#' Ma, W., & de la Torre, J. (2020). GDINA: An R package for cognitive diagnosis modeling. \emph{Journal of Statistical Software}, \emph{93}(14). https://doi.org/10.18637/jss.v093.i14
#'
#' @export
#'
#' @examples
#' \donttest{
#' library(GDINA)
#' dat <- sim30DINA$simdat
#' Q <- sim30DINA$simQ
#' fit1 <- RDINA(dat, Q)
#' fit2 <- RDINA2GDINA(fit1)
#' modelfit(fit2) # Model fit evaluation
#' itemfit(fit2) # Item fit evaluation
#' }
RDINA2GDINA <- function(fit){
if(!inherits(fit, "RDINA")){stop("Error in RDINA2GDINA: fit must be of class 'RDINA'.")}
dat <- fit$specifications$dat
Q <- fit$specifications$Q
N <- nrow(dat)
J <- nrow(Q)
K <- ncol(Q)
L <- 2^K
phi <- fit$phi
catprob.parm <- list()
for(j in 1:J){
lj <- 2^sum(Q[j,])
if(fit$specifications$gate == "AND"){
catprob.parm[[j]] <- c(rep(phi, lj - 1), 1 - phi)
} else {
catprob.parm[[j]] <- c(phi, rep(1 - phi, lj - 1))
}
}
model <- ifelse(fit$specifications$gate == "AND", "DINA", "DINO")
res <- GDINA::GDINA(dat, Q, model = model, catprob.parm = catprob.parm, control = list(maxitr = 0), verbose = 0)
res$struc.parm <- as.numeric(fit$post.probs$lp)
res$testfit[3] <- 1
res$testfit[-3] <- fit$test.fit
res$technicals$free.item.npar <- 1
res$technicals$total.npar <- L
res$extra$call <- "RDINA"
return(res)
}
5 changes: 3 additions & 2 deletions R/personFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @description This function calculates the standardized log-likelihood statistic (lZ; Cui & Li, 2015; Drasgow et al. 1985) and the proposals for correcting its distribution discussed in Santos et al. (2019).
#'
#' @param fit A G-DINA model fit object from the \code{GDINA} package (Ma & de la Torre, 2020).
#' @param fit An object of class \code{RDINA} or \code{GDINA} (Ma & de la Torre, 2020).
#' @param att.est What attribute estimates are used? The default is \code{"MLE"}.
#' @param sig.level Scalar numeric. Alpha level for decision. Default is 0.05.
#' @param p.adjust.method Scalar character. Correction method for p-values. Possible values include "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", and "none". See p.adjust function from the stats R package for additional details. Default is BH.
Expand Down Expand Up @@ -36,8 +36,9 @@
#' res.personFit <- personFit(fit)
#' res.personFit
#' }

personFit <- function(fit, att.est = "MLE", sig.level = 0.05, p.adjust.method = "BH"){
if(inherits(fit, "RDINA")){fit <- RDINA2GDINA(fit)}
if(!inherits(fit, "GDINA")){stop("Error in personFit: fit must be of class 'RDINA' or 'GDINA'.")}
dat <- fit$options$dat
Q <- fit$options$Q
N <- nrow(dat)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![](http://cranlogs.r-pkg.org/badges/grand-total/cdmTools?color=blue)](https://cran.r-project.org/package=cdmTools)

## How to cite this package
Nájera, P., Sorrel, M. A., & Abad, F. J. (2023). *cdmTools: Useful Tools for Cognitive Diagnosis Modeling*. R package version 1.0.4. https://cran.r-project.org/web/packages/cdmTools/.
Nájera, P., Sorrel, M. A., & Abad, F. J. (2024). *cdmTools: Useful Tools for Cognitive Diagnosis Modeling*. R package version 1.0.5. https://cran.r-project.org/web/packages/cdmTools/.
## Features of the package
* Empirical Q-matrix estimation and validation
* Empirical dimensionality assessment of CDM data
Expand Down
Binary file removed cdmTools_1.0.4.tar.gz
Binary file not shown.
Binary file added cdmTools_1.0.5.tar.gz
Binary file not shown.
25 changes: 25 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## cdmTools_1.0.5 (January 03, 2024)

#### News & Comments
* We have added the RDINA2GDINA function
* We have slightly modified the CA.MI and personFit functions
* We have listed Kevin Santos as a contributor

#### Test envirnoments
* Local Windows 10 x64, R 4.1.2
* Ubuntu Linux 16.04 LTS, R-release, GCC (check_rhub)
* Windows Server 2008 R2 SP1, R-devel, 32/64 bit (check_rhub)
* Fedora Linux, R-devel, clang, gfortran (check_rhub)
* (check_win_devel)

#### R CMD check results

* There were no ERRORs or WARNINGs.
* There was 1 NOTE:
```
Maintainer: 'Pablo Nájera <[email protected]>'
Uses the superseded package: 'doSNOW'
```
The `doSNOW` package is required to show a progress bar inside a `foreach` loop.

## cdmTools_1.0.4 (November 10, 2023)

#### News & Comments
Expand Down
4 changes: 2 additions & 2 deletions man/CA.MI.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions man/RDINA2GDINA.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/personFit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29ddbb6

Please sign in to comment.