alarm_plot_data {ATQ} | R Documentation |
Create Alarm Plot Data Object
Description
This function creates an object of class "alarm_plot_data" from epidemic data and best models. It ensures that the input data is in the correct format for plotting.
Usage
alarm_plot_data(epidemic_data, best_models)
Arguments
epidemic_data |
A data frame or list of data frames containing epidemic data. |
best_models |
A list of data frames containing the best models for each metric. |
Value
An object of class "alarm_plot_data" containing the epidemic data and best models.
Examples
# Generate sample epidemic data
set.seed(123)
epidemic_data <- data.frame(
Date = rep(1:300, 3),
ScYr = rep(1:3, each = 300),
pct_absent = runif(900, 0, 0.1),
lab_conf = rpois(900, lambda = 5),
ref_date = rep(c(rep(0, 299), 1), 3),
Case = rbinom(900, 1, 0.1),
window = rep(c(rep(0, 280), rep(1, 20)), 3)
)
# Generate sample best models data
generate_best_model <- function() {
data.frame(
Date = sample(1:300, 50),
ScYr = sample(1:3, 50, replace = TRUE),
Alarm = sample(0:1, 50, replace = TRUE),
lag = sample(1:15, 50, replace = TRUE),
thres = runif(50, 0, 1)
)
}
best_models <- list(
AATQ = generate_best_model(),
FATQ = generate_best_model(),
FAR = generate_best_model(),
ADD = generate_best_model(),
WFATQ = generate_best_model(),
WAATQ = generate_best_model()
)
# Create alarm_plot_data object
plot_data <- alarm_plot_data(epidemic_data, best_models)
# Check the structure of the resulting object
str(plot_data)
[Package ATQ version 0.2.2 Index]