Extract diagnostic metrics from model fit and data
extract_diagnostics.Rd
This function extracts various diagnostic metrics from a fitted EpiNow2
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.
Value
A data.frame
containing the extracted diagnostic metrics. The
data frame includes the following columns:
diagnostic
: The name of the diagnostic metric.value
: The value of the diagnostic metric.job_id
: The unique identifier for the job.task_id
: The unique identifier for the task.disease,geo_value,model
: Metadata for downstream processing.
Details
The following diagnostics are calculated:
mean_accept_stat
: The average acceptance statistic across all chains.p_divergent
: The proportion of divergent transitions across all samples.n_divergent
: The number of divergent transitions across all samples.p_max_treedepth
: The proportion of samples that hit the maximum tree depth.p_high_rhat
: The proportion of parameters with Rhat values greater than 1.05, indicating potential convergence issues.n_high_rhat
: The number of parameters with Rhat values greater than 1.05, indicating potential convergence issues.low_case_count_flag
: A flag indicating if there are low case counts in the data. Seelow_case_count_diagnostic()
for more information on this diagnostic.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.