1. Getting Started with AMPH Forecast Suite
Source:vignettes/01-getting-started.Rmd
01-getting-started.RmdIntroduction
The AMPH Forecast Suite provides a comprehensive toolkit for building infectious disease forecasting pipelines and hubs. This vignette demonstrates the basic workflow for using this package. This package and suite are still under active development, and we welcome contributions and feedback from the community.
Installation
First, ensure you have R (version 4.0 or higher) and RStudio installed.
# Check R version
R.Version()$version.string
#> [1] "R version 4.5.1 (2025-06-13)"Next, set your git credentials, if you have not already done this. Github no longer supports password authentication for git operations. You will need to create a personal access token (PAT) to use in place of your password for git operations.
Run this to open a webpage to get a new personal access token (PAT):
usethis::create_github_token(
scopes = c("repo", "user", "gist", "workflow"),
description = "Git operations from R",
host = NULL
)
#> ☐ Call `gitcreds::gitcreds_set()` to register this token in the local Git
#> credential store.
#> ! On Linux, it can be tricky to store credentials persistently.
#> ℹ Read more in the 'Managing Git(Hub) Credentials' article
#> (<https://usethis.r-lib.org/articles/articles/git-credentials.html>).
#> ℹ It is also a great idea to store this token in any password-management
#> software that you use.
#> ☐ Open URL
#> <https://github.com/settings/tokens/new?scopes=repo,user,gist,workflow&description=Git
#> operations from R>.See this guide or github website for more information on creating a GitHub personal access token (PAT).
Then, set your git credentials in R (you can also do this via the terminal or Git Bash):
# Set your git credentials (replace with your actual info)
install.packages("gitcreds")
gitcreds::gitcreds_set(
username = "your_github_username",
password = "your_github_token"
)Next, install the AMPH Forecast Suite from CRAN or GitHub:
# Install remotes if you haven't already
install.packages("remotes")
# Install AMPH Forecast Suite
remotes::install_github("ACCIDDA/AMPH_Forecast_Suite")Next, install the required forecasting packages:
library(AMPHForecastSuite)
# Install all forecasting packages
install_forecast_packages()You can also selectively install specific categories:
# Install only hubverse and forecasting packages
install_forecast_packages(
install_hubverse = TRUE,
install_forecasting = TRUE,
install_epi = FALSE,
install_data = FALSE
)Setting Up Directory Structure
Set up a directory structure for your forecasting project:
# Create project directory and subdirectories
# this sets the working directory to the new project directory
setup_file_structure(project_dir = "My_Forecast_Project")Next steps
- Define the forecasting effort:
- Determine forecasting disease and targets
- Identify data sources and geographies
- Pull and manipulating data to use with forecasting models
- Run forecasting models
- Ensemble, visualize, and evaluate forecasts
- Share forecasts with stakeholders
For more information, see the package documentation and function help pages.