Skip to content

Commit

Permalink
Language clarification in extract_diagnostics (#109)
Browse files Browse the repository at this point in the history
* Language clarification in `extract_diagnostics`

Clarified:

* "These diagnostics are then flagged if they exceed specific thresholds" makes it sound like the returned dataframe flags each __individually__ (which it doesn't, hence suggest change of language)
* "Exceed specific thresholds": sometimes it's if the value is below a threshold hence I suggest reword to "outside acceptable range"

Possible refactors / improvements of this function could be:

<details>

1. Return a flag for each diagnostic rather than for all of them jointly. Would it ever be useful to know in particular which diagnostic was violated (straight away, I know it could be recovered with some digging)
2. Allowing setting of the thresholds. As a user I imagine this might be useful, like if certain conditions mean that diagnostics are over or under flagging. I can see here it's a bit annoying to do and would probably have to be like a user input list of named values.

* Redocument
  • Loading branch information
athowes authored Dec 11, 2024
1 parent 7712a7d commit 66ac3ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions R/extract_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#' model and provided data. It checks for low case counts and computes
#' diagnostics from the fitted model, including the mean acceptance
#' statistic, divergent transitions, maximum tree depth, and Rhat values.
#' These diagnostics are then flagged if they exceed specific thresholds,
#' and the results are returned as a data frame.
#' Additionally, a combined flag is computed indicating if any diagnostics
#' are outside an acceptable range. The results are returned as a data frame.
#'
#' @param fit The model fit object from `EpiNow2`
#' @param data A data frame containing the input data used in the model fit.
Expand Down Expand Up @@ -42,9 +42,9 @@
#' counts in the data. See \code{low_case_count_diagnostic()} for more
#' information on this diagnostic.
#' \item \code{epinow2_diagnostic_flag}: A combined flag that indicates if
#' any diagnostic thresholds are exceeded. The diagnostic thresholds
#' (1) mean_accept_stat < 0.1, (2) p_divergent > 0.0075, (3)
#' p_max_treedepth > 0.05, and (4) p_high_rhat > 0.0075.
#' any diagnostic metrics are outside an accepted range, as determined
#' by the thresholds: (1) mean_accept_stat < 0.1, (2) p_divergent >
#' 0.0075, (3) p_max_treedepth > 0.05, and (4) p_high_rhat > 0.0075.
#' }
#' @export
extract_diagnostics <- function(fit,
Expand Down
2 changes: 1 addition & 1 deletion man/Exclusions.Rd

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

10 changes: 5 additions & 5 deletions man/extract_diagnostics.Rd

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

0 comments on commit 66ac3ea

Please sign in to comment.