Skip to content

Commit

Permalink
Merge pull request #45 from wjakethompson/reliability-thresholds
Browse files Browse the repository at this point in the history
Probability thresholds for reliability
  • Loading branch information
wjakethompson authored Feb 12, 2024
2 parents 44d3e23 + f2eb511 commit 973a3b6
Show file tree
Hide file tree
Showing 12 changed files with 2,501 additions and 2,723 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
config:
- {os: macOS-latest, r: 'release', rtools: ''}
- {os: windows-latest, r: 'release', rtools: '42'}
- {os: windows-latest, r: 'release', rtools: '43'}
- {os: ubuntu-latest, r: 'devel', rtools: '', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release', rtools: ''}
- {os: ubuntu-latest, r: 'oldrel-1', rtools: ''}
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Biarch: true
SystemRequirements: GNU make
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# measr (development version)

* Updated reliability functionality to allow for the calculation of accuracy and consistency with different thresholds for determining attribute classifications.

# measr 1.0.0

## New documentation
Expand Down
8 changes: 6 additions & 2 deletions R/reliability.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ reliability <- function(model, ...) {
#' probability should be reported. This is the *expected a posteriori* (EAP)
#' reliability.
#'
#' @param threshold For `map_reliability`, the threshold applied to the
#' attribute-level probabilities for determining the binary attribute
#' classifications.
#'
#' @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).
Expand Down Expand Up @@ -66,14 +70,14 @@ reliability <- function(model, ...) {
#' )
#'
#' reliability(rstn_mdm_lcdm)
reliability.measrdcm <- function(model, ..., force = FALSE) {
reliability.measrdcm <- function(model, ..., threshold = 0.5, force = FALSE) {
if ((!is.null(model$reliability) && length(model$reliability) > 0) &&
!force) {
return(model$reliability)
}

# coerce model into a list of values required for reliability
obj <- reli_list(model)
obj <- reli_list(model, threshold = threshold)
att_names <- model$data$qmatrix %>%
dplyr::select(-"item_id") %>%
colnames()
Expand Down
4 changes: 2 additions & 2 deletions R/utils-reliability.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ create_reli_list <- function(n_resp, n_att, n_class, profile_vec, class_att,
return(ret_list)
}

reli_list <- function(model) {
reli_list <- function(model, threshold) {
n_resp <- dplyr::n_distinct(model$data$data$resp_id)
n_att <- ncol(model$data$qmatrix) - 1L
n_class <- 2 ^ n_att
Expand All @@ -160,7 +160,7 @@ reli_list <- function(model) {
# map estimates
binary_att <- attr_probs %>%
dplyr::mutate(dplyr::across(dplyr::everything(),
~dplyr::case_when(.x >= 0.5 ~ 1L,
~dplyr::case_when(.x >= threshold ~ 1L,
TRUE ~ 0L))) %>%
as.matrix() %>%
unname() %>%
Expand Down
6 changes: 5 additions & 1 deletion man/reliability.Rd

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

11 changes: 7 additions & 4 deletions pkgdown/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--nav-bkg: #023047; /* nav bar background */
--nav-link: #8ecae6; /* nav bar link color */
--nav-higl: #219ebc; /* nav active and highlight */
--ver-norm: #023047; /* pkg version background - release version */
--ver-norm: #219ebc; /* pkg version background - release version */
--ver-devp: #d7263d; /* pkg version background - dev version */

--pg-header: #023047; /* heading color & text links */
Expand Down Expand Up @@ -41,9 +41,12 @@
}

/* Package version */
.badge-danger {
color: #fff;
background-color: var(--ver-devp);
small.text-danger {
color: var(--ver-devp) !important;
}

small.text-muted {
color: var(--ver-norm) !important;
}

/* Color of links in navbar and hover links */
Expand Down
Loading

0 comments on commit 973a3b6

Please sign in to comment.