Description Usage Arguments Value
View source: R/prep_linelist.R
prep_linelist()
converts a linelist to an incidence curve, replaces
anomalous counts with the expected value, and decomposes the result into
trend, seasonality, and remainder components. It also filters out reporting
errors and truncates the data at the last fully observed incidence date
(as defined by pct_reported
, see that parameter for details). All
calculations are performed on the log scale, but the result is returned on
the input scale (assumed linear).
1 2 3 4 5 6 7 8 9 10 11 12 | prep_linelist(
.data,
.collection_date = "collection_date",
.report_date = "report_date",
start_date = "2020-03-12",
trend = "30 days",
period = "7 days",
delay_period = "14 days",
pct_reported = 0.9,
cutoff = 0.05,
plot_anomalies = FALSE
)
|
.data |
A data frame containing one incident observation per row |
.collection_date |
|
.report_date |
|
start_date |
The start date of the epidemic;
defaults to |
trend |
The length of time to use in trend decomposition; can be a
time-based definition (e.g. "1 month") or an integer number of days. If
|
period |
The length of time to use in seasonal decomposition; can be a
time-based definition (e.g. "1 week") or an integer number of days. If
|
delay_period |
The length of time to use in calculating reporting
delay; can be a time-based definition (e.g. "2 weeks") or an integer number
of days. If |
pct_reported |
The percent of total cases reported before considering
a collection date to be fully observed. It is not recommended to set this
to |
cutoff |
The cutoff value for anomaly detection; controls both the maximum percentage of data points that may be considered anomalies, as well as the critical value for the Generalized Extreme Studentized Deviate test used to detect the anomalies. Can be interpreted as the desired maximum probability that an individual data point is labeled an anomaly. |
plot_anomalies |
Should anomalies be plotted for visual inspection? If
|
A tibble
with a date column (named the same as the column specified
by .collection_date
) and observed
, season
, trend
, and remainder
columns. All numeric columns have outlier replaced.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.