View source: R/model_eligibility.R
calc_sd_check | R Documentation |
num_sd
sample standard deviations below the sample mean of
observations in a "lookback" window. The standard deviations and means of
observations may be calculated over different windows. Tables listing the
included excluded location-model pairs are saved in sd_check_table_path
,
and plots illustrating the exclusion criteria are saved in
sd_check_plot_path
.Compute check of whether mean of forecast medians in a "lookahead" window
is more than num_sd
sample standard deviations below the sample mean of
observations in a "lookback" window. The standard deviations and means of
observations may be calculated over different windows. Tables listing the
included excluded location-model pairs are saved in sd_check_table_path
,
and plots illustrating the exclusion criteria are saved in
sd_check_plot_path
.
calc_sd_check(
qfm,
observed_by_location_target_end_date,
sd_check_table_path = NULL,
sd_check_plot_path = NULL,
lookback_method = c("by observations", "dy dates"),
lookback_window = 1:14,
lookback_window_for_mean = 1:7,
lookback_window_for_sd = 1:14,
lookahead_window = 1:7,
exclude_below = TRUE,
exclude_above = TRUE,
num_sd = 4,
show_stats = FALSE
)
qfm |
matrix of model forecasts of class QuantileForecastMatrix |
observed_by_location_target_end_date |
data frame of observed values |
sd_check_table_path |
where to save csv files listing exclusions |
sd_check_plot_path |
where to save plots |
lookback_method |
if set to "by observations", mean and sd are calculated for specified windows of observations; of set to "by dates", mean and sd are calculated for observations within specified date windows |
lookback_window |
vector of (not necessarilly consecutive) observation or date indices starting with index 1 for the most recent available observation and counting (by observation or calendar date) backwards; should contain the union of indices for mean and sd windows (with an error thrown otherwise) and gives the window of observations that the line plot will cover |
lookback_window_for_mean |
vector of indices giving the the mean window |
lookback_window_for_sd |
vector of indices giving the the sd window |
lookahead_window |
vector of indices giving the window over which forecast means are calculated |
num_sd |
number of standard deviations to use for cutoff |
data frame with a row for each combination of location and model and a logical column called 'eligibility' with entry "more than four SDs below 2-week mean of hospitalization point forecasts" if check fails
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.