Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Imports:
projections,
incidence,
jsonlite
Suggests:
Suggests:
DiagrammeR,
knitr,
rmarkdown,
devtools,
Expand Down
3 changes: 0 additions & 3 deletions vignettes/.gitignore

This file was deleted.

39 changes: 31 additions & 8 deletions vignettes/acciddasuite.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,27 @@ knitr::opts_chunk$set(

# Introduction

The `acciddasuite` package provides tools for building infectious disease forecasts and relies on the [`fable`](https://fable.tidyverts.org/) framework.
The `acciddasuite` package provides tools for building infectious disease forecasts and relies on the [`fable`](https://fable.tidyverts.org/) modeling framework. The overall goal is to provide public health professionals with an easily-adoptable approach to generating an ensemble of outputs from statistical models, evaluating forecasts, and visualizing outputs.

This vignette demonstrates a basic example of generating and evaluating forecasts following the standard forecasting workflow described by [Hyndman & Athanasopoulos (2021)](https://otexts.com/fpp3/basic-steps.html).
This vignette demonstrates a basic example of generating, evaluating, and visualizing forecasts following the standard forecasting workflow described by [Hyndman & Athanasopoulos (2021)](https://otexts.com/fpp3/basic-steps.html).

Updated forecasting package information can be found [here](https://robjhyndman.com/hyndsight/forecast9.html).

# Forecasting Workflow

## `get_data`
## `Forecast Planning`

**To get more information about how to know whether forecasting is the best approach for your task, follow the steps in [this](forecast_planning.html) article.**

## `Time Series Data`

The first step of generating disease forecasts is providing time series/surveillance data; the data that the mdoel will assume has already happened.

**If you would like to load your own surveillance, you can follow [these](external_data.html) steps for formatting.**

For demonstration purposes, we will load surveillance data from the [CDC National Health Safety Network](https://data.cdc.gov/Public-Health-Surveillance/Weekly-Hospital-Respiratory-Data-HRD-Metrics-by-Ju/mpgq-jmmr/about_data). The `get_data()` function provides a convenient interface to access this data using the [`epidatr`](https://cmu-delphi.github.io/epidatr/) package.
For demonstration purposes, we will load surveillance data from the [CDC National Health Safety Network](https://data.cdc.gov/Public-Health-Surveillance/Weekly-Hospital-Respiratory-Data-HRD-Metrics-by-Ju/mpgq-jmmr/about_data)using `acciddasuite`'s `get_data()` function. The data dictionary is available [here](https://dev.socrata.com/foundry/data.cdc.gov/mpgq-jmmr).

The `get_data()` function provides a convenient interface to access this data using the [`epidatr`](https://cmu-delphi.github.io/epidatr/) package.

```{r, get_data}
library(dplyr)
Expand All @@ -40,13 +50,17 @@ library(acciddasuite)
df <- get_data(pathogen = "covid", geo_values = "nc")
head(df)

df <- get_data(pathogen = "flu", geo_values = "ny")

head(df)
```

```{r, to_csv, echo = FALSE}
df |> write.csv("example_data.csv", row.names = FALSE)
```

To look at what `df` looks like, you can access the example `csv` file here: [example_data.csv](https://github.com/ACCIDDA/acciddasuite/blob/main/example_data.csv).
To examine `df` in more detail, you can access the example `csv` file here: [example_data.csv](https://github.com/ACCIDDA/acciddasuite/blob/main/example_data.csv).


## Time Series Cross-Validation

Expand All @@ -60,10 +74,14 @@ We visualize the data and decide on the `eval_start_date`.
eval_start_date <- max(df$target_end_date) - 90
```

Default models are: 
Default models are:

* `SNAIVE` (Seasonal Naïve): Assumes this week will look like the same week last year. The simplest possible baseline.

* `ETS` (Exponential Smoothing): A weighted average where recent weeks matter more than older ones. Adapts to trends and seasonal patterns.

* `THETA`: Splits the data into a long-term trend and short-term fluctuations, forecasts each separately, then combines them.

* `ARIMA`: Learns repeating patterns from past values to predict future ones. Auto-configured to find the best fit.

```{r, models}
Expand All @@ -83,9 +101,15 @@ Visualize forecasts by accessing the `plot` element of the forecast object:
fcast$plot
```

View forecast evaluation by viewing the `score` element of the object:
```{r, score-forecast}
fcast$score
```


## Adding `extra_models`

Additonal models can be added by defining them in a list and passing them to `get_fcast()`. The models should be compatible with the fable framework (see [fable documentation](https://fabletools.tidyverts.org/articles/extension_models.html) for more information).
Additional models can be added by defining them in a list and passing them to `get_fcast()`. The models should be compatible with the fable framework (see [fable documentation](https://fabletools.tidyverts.org/articles/extension_models.html) for more information).

```{r, extra-models}
library(fable)
Expand All @@ -107,7 +131,6 @@ fcast = get_fcast(
```

You can check how long each step took by calling `pipetime::get_log()`:

```{r, timing}
get_log()
```
Expand Down
Loading
Loading