This function estimates the disease specific threshold, based on previous seasons. If the disease threshold is estimated between ]0:1] it will be set to 1.
estimate_disease_threshold(
tsd,
season_start = 21,
season_end = season_start - 1,
skip_current_season = TRUE,
min_significant_time = 3,
max_gap_time = 1,
use_prev_seasons_num = 3,
pick_significant_sequence = c("longest", "earliest"),
season_importance_decay = 0.8,
conf_levels = c(0.25, 0.5, 0.75),
...
)An object of class tsd_disease_threshold, containing;
....
A tsd object containing time series data
Integers giving the start and end weeks of the seasons to stratify the observations by.
A logical. Do you want to skip your current season?
An integer specifying how many time steps that have to be significant to the sequence to be considered in estimation.
A numeric value specifying how many time steps there is allowed to be non-significant between two significant sequences for maybe considering them as the same sequence. Sometimes e.g. vacations or less testing can lead to false decreases.
An integer specifying how many previous seasons you want to include in estimation.
A character string specifying which significant sequence to pick from each season.
longest: The longest sequence of size min_significant_time closest to the peak.
earliest: The earliest sequence of size min_significant_time of the season.
A numeric value between 0 and 1, that specifies the weight applied to previous
seasons. It is used as season_importance_decay^(number of seasons back), whereby the weight for the most recent
season will be season_importance_decay^0 = 1. This parameter allows for a decreasing weight assigned to prior
seasons, such that the influence of older seasons diminishes exponentially.
A numeric vector specifying the confidence levels for parameter estimates. The values have
to be unique and in ascending order, the first percentile is the disease specific threshold.
Specify one or three confidence levels e.g.: c(0.25) c(0.25, 0.5, 0.75).
Arguments passed to the seasonal_onset() or fit_percentiles() function.
only_current_season = FALSE and disease_threshold = NA_real_ cannot be changed in seasonal_onset().
# Generate seasonal data
tsd_data <- generate_seasonal_data(
years = 3,
start_date = as.Date("2021-01-01"),
noise_overdispersion = 3
)
# Estimate disease threshold
estimate_disease_threshold(tsd_data)
Run the code above in your browser using DataLab