Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.10 2024 04 08 run #17

Merged
merged 2 commits into from
Apr 8, 2024
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
73 changes: 73 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
build:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
id-token: write
pages: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: "2.19.2"

- uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
install-r: false
extra-repositories: "https://mc-stan.org/r-packages/"
- uses: r-lib/actions/setup-r-dependencies@v2
with:
working-directory: cfaforecastrenewalww
cache: true
pak-version: rc
extra-packages: any::pkgdown local::.
needs: website
- name: "Install cmdstan via cmdstanr"
uses: ./.github/actions/install-cmdstan

- name: Build site
run: "pkgdown::build_site_github_pages('cfaforecastrenewalww', new_process = FALSE, install = FALSE)"
shell: Rscript {0}

- name: Upload artifact for GH pages deployment
uses: actions/upload-pages-artifact@v2
with:
path: "cfaforecastrenewalww/docs/"

deploy:
# check builds on PRs but only deploy when main changes
if: ${{ github.event_name != 'pull_request' }}
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub pages
uses: actions/[email protected]
4 changes: 4 additions & 0 deletions cfaforecastrenewalww/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
^data-raw$

^Makefile$
^_pkgdown\.yml$
^docs$
^pkgdown$
^\.github$
1 change: 1 addition & 0 deletions cfaforecastrenewalww/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs
15 changes: 12 additions & 3 deletions cfaforecastrenewalww/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Authors@R:
family = "Johnson",
role = c("aut", "cre"),
email = "[email protected]"),
person(given = "Sam Abbott",
person(given = "Sam",
family = "Abbott",
role = c("aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-8057-8037")),
Expand All @@ -21,11 +22,18 @@ Authors@R:
person(given = "Dylan",
family = "Morris",
role = c("aut"),
email = "[email protected]"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-3655-406X")),
person(given = "Scott",
family = "Olesen",
role = c("aut"),
email = "[email protected]"))
email = "[email protected]"),
person(given = "George",
family = "Vega Yon",
role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-3171-0844"))
)
Description: Semi-mechanistic renewal approach jointly calibrating to state-level
hospital admissions and site-level wastewater concentrations
License: Apache 2.0 LICENSE
Expand Down Expand Up @@ -80,3 +88,4 @@ Encoding: UTF-8
LazyData: true
Config/testthat/edition: 3
Config/Needs/check: rcmdcheck, testthat
Roxygen: list(markdown = TRUE)
154 changes: 154 additions & 0 deletions cfaforecastrenewalww/R/example_params.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#' @title Example model parameters and hyperparameters for priors
#' @name example_params
#' @docType data
#' @description
#' The `example_params.toml` file contains modifiable model inputs that get passed
#' to stan to fit the model. The parameters used here have been chosen by the
#' authors to best reflect SARS-CoV-2 infection, hospital admissions, and
#' wastewater components. See the
# nolint start
#' [`Model Parameters`](https://github.com/CDCgov/wastewater-informed-covid-forecasting/blob/prod/model_definition.md#model-parameters)
# nolint end
#' section of the model_definition.md in our Github for more information/justification of these
#' prior/parameter choices.
#'
#' If running the model on SARS-CoV-2 hospital admissions and wastewater concentrations,
#' it may be reasonable to use these example parameters as a starting place for your
#' data (aka none are dataset specific). The values that will need tweaking for a
#' specific dataset are defined in the documentation for [example_df].
#'
#' ```
#' example_params <- cfaforecastrenewalww::get_params(
#' fs::path_package(
#' "extdata", "example_params.toml",
#' package = "cfaforecastrenewalww"
#' )
#' )
#' ```
#'
#' @format
#' A .toml file that gets formatted as a 1 row dataframe where each column is a
#' parameter name and its value is indicated in the first row
#' \describe{
#' \item{\code{uot}}{"unoubserved time" an integer that dictates the duration
#' of time (in days) that the model is initialized with exponential growth
#' before any observations are available.}
#' \item{\code{r_prior_mean}}{Prior on mean R(t)}
#' \item{\code{r_prior_sd}}{Prior on standard deviation in the mean R(t)}
#' \item{\code{sigma_rt_prior}}{Prior on the standard deviation between
#' subpopulation level R(t)s}
#' \item{\code{i0_certainty}}{Prior on the certainty in initial infections
#' I0/N, representing the effective number of binomial trials in the beta
#' prior centered on I0/N}
#' \item{\code{initial_growth_prior_mean}}{Prior on mean exponential growth
#' rate(daily) in the unobserved time during infection initialization}
#' \item{\code{initial_growth_prior_sd}}{Prior on the standard deviation in
#' the daily exponential growth rate during the unobserved time}
#' \item{\code{autoreg_rt_a}}{Prior on the autoregulation term on the R(t)
#' trend and the AR(1) process in subpopulation level R(t), shape1 parameter of
#' a beta prior}
#' \item{\code{autoreg_rt_b}}{Prior on the autoregulation term on the R(t)
#' trend and the AR(1) process in subpopulation level R(t), shape2 parameter of
#' a beta prior}
#' \item{\code{eta_sd_sd}}{Prior on standard deviation in the deviation in the
#' R(t) trend}
#' \item{\code{infection_feedback_prior_logmean}}{Prior on the log mean
#' infection feedback term}
#' \item{\code{infection_feedback_prior_logsd}}{Prior on log standard
#' deviation of the infection feedback term)}
#' \item{\code{p_hosp_mean}}{Prior on the mean infection hospital admissions
#' rate}
#' \item{\code{p_hosp_sd_logit}}{Prior on the logit scale of the standard deviation
#' of the mean infection hospital admissions rate}
#' \item{\code{p_hosp_sd_sd}}{Prior on the standard deviation in the time-varying
#' deviation in the infection hospital admissions rate}
#' \item{\code{inv_sqrt_phi_prior_mean}}{Prior on the mean of the inverse square
#' root of the negative binomial `phi` of the hospital admissions
#' observation process}
#' \item{\code{inv_sqrt_phi_prior_sd}}{Prior on the standard deviation of the
#' inverse square root of the negative binomial `phi` of the hospital
#' admissions observation process}
#' \item{\code{wday_effect_prior_mean}}{Prior on the mean amount of weight
#' assigned to each day of the week proportional to the whole week}
#' \item{\code{wday_effect_prior_sd}}{Prior on the standard deviation in the
#' amount of weight assigned to each day of the week proportional to the whole
#' week}
#' \item{\code{ml_of_ww_per_person_day}}{Set value of the estimated number
#' of mL of wastewter produced per person per day}
#' \item{\code{t_peak_mean}}{Prior on the mean time of peak fecal shedding in
#' wastewater}
#' \item{\code{t_peak_sd}}{Prior on the standard deviation in the time of peak
#' fecal shedding in wastewater}
#' \item{\code{viral_peak_mean}}{Prior on mean peak viral load (in log10 scale)
#' of fecal shedding of viral genomes in wastewaster}
#' \item{\code{viral_peak_sd}}{Prior on the standard deviation in the peak viral
#' load (in log10 scale) of fecal shedding of viral genomes in wasteawter}
#' \item{\code{duration_shedding_mean}}{Prior on mean duration of fecal shedding
#' in wastewater}
#' \item{\code{duration_shedding_sd}}{Prior on the standard deviation of
#' fecal shedding in wastewater}
#' \item{\code{log10_g_prior_mean}}{Prior on the mean number of genomes shed
#' per infected individual in log10 scale}
#' \item{\code{log10_g_prior_sd}}{Prior on standard deviation in the number of
#' genomes shed per infected individual in log10 scale}
#' \item{\code{log_g_prior_mean}}{Prior on the mean number of genomes shed
#' per infected individual in log scale}
#' \item{\code{log_g_prior_sd}}{Prior on standard deviation in the number of
#' genomes shed per infected individual in log scale}
#' \item{\code{sigma_ww_site_prior_mean_mean}}{Prior on mean of the mean
#' site-lab-level observation error}
#' \item{\code{sigma_ww_site_prior_mean_sd}}{Prior on standard deviation of the
#' mean site-lab-level observation error}
#' \item{\code{sigma_ww_site_prior_sd_mean}}{Prior on the mean of the standard
#' deviation across sites in site-lab-level observation errors}
#' \item{\code{sigma_ww_site_prior_sd_sd}}{Prior on standard deviaiton of the
#' standard deviation across sites in site-lab level observation errors}
#' \item{\code{ww_site_mod_sd_sd}}{Prior on the standard deviation in the
#' standard deviation between site-lab level multipliers}
#' \item{\code{log_phi_g_prior_mean}}{Prior on mean individual level dispersion
#' in number of genomes shed per infection, not currently used in the model}
#' \item{\code{log_phi_g_prior_sd}}{Prior on the standard deviation in
#' individual level dispersion in number of genomes shed per infection, not
#' currently used in the model}
#' \item{\code{mu_gi}}{Set parameter for the log mean of the generation
#' interval}
#' \item{\code{sigma_gi}}{Set parameter for the log standard deviaiton of the
#' generation interval}
#' \item{\code{gt_max}}{Integer indicating the maximum number of days
#' for which secondary transmission can occur}
#' \item{\code{r}}{Exponential growth rate on the correction factor applied to
#' the incubation period estimate}
#' \item{\code{backward_shape}}{Set parameter for the backward shape parameter
#' of the Weibull distribution for the incubation period}
#' \item{\code{backward_scale}}{Set parameter for the backward scale parameter
#' of the Weibull distribution for the incubation period}
#' \item{\code{neg_binom_mu}}{Set parameter for the mean of the negative
#' binomially distributed time from symptom onset to hospital admission}
#' \item{\code{neg_binom_size}}{Set parameter for the size parameter of the
#' negative binomially distributed time from symptom onset to hospital
#' admissions}
#' }
#' @details
#' These parameters specify the priors on key parameters, except where indicated
#' as set parameters. In these instances (generation interval, incubation period,
#' symptom onset to hospital admissions) we pre-define the delay distrubions using
#' estimates from the literature.
#'
#' @source
#' The set parameters for the generation interval and incubation period were
#' obtained from:
#' Park, Sang Woo, et al. ["Inferring the differences in incubation-period
#' and generation-interval distributions of the Delta and Omicron variants of
# nolint start
#' SARS-CoV-2."](https://doi.org/10.1073/pnas.2221887120)
# nolint end
#' Proceedings of the National Academy of Sciences 120.22 (2023):
#' e2221887120.
#'
# nolint start
#' See [`Model Parameters`](https://github.com/CDCgov/wastewater-informed-covid-forecasting/blob/prod/model_definition.md#model-parameters)
# nolint end
#' for the full set of references for each prior.
#'
#' @keywords datasets
NULL
5 changes: 5 additions & 0 deletions cfaforecastrenewalww/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `cfaforecastrenewalww` package

This R package provides functions and data infrastructure for running the wastewater-informed COVID-19 hospital admissions models published on GitHub at [`cdcgov/wastewater-informed-covid-forecasting`](https://github.com/cdcgov/wastewater-informed-covid-forecasting) and submitted to the [Covid-19 Forecast Hub](https://covid19forecasthub.org/) as [`cfa-wwrenewal`](https://github.com/reichlab/covid19-forecast-hub/blob/HEAD/data-processed/cfa-wwrenewal). See that repository's [`README`](https://github.com/cdcgov/wastewater-informed-covid-forecasting/blob/HEAD/README.md) and [model definition](https://github.com/cdcgov/wastewater-informed-covid-forecasting/blob/HEAD/model_definition.md) for additional technical and mathematical details on the model.

Note that while it is installable and has some unit tests and documentation, **it is an alpha version**, not a beta or a full first release. It is built more to support our specific model-fitting use case than for general wastewater modeling, though we encourage others to adapt and generalize the codebase and to submit improvements back to us as open source contributions. We also enthusiastically encourage users to help us by filing [issues](https://github.com/cdcgov/wastewater-informed-covid-forecasting/issues) on GitHub if they run into trouble or find a bug.
8 changes: 8 additions & 0 deletions cfaforecastrenewalww/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
url: https://didactic-doodle-g3m75r1.pages.github.io/
template:
bootstrap: 5

repo:
url:
home: https://github.com/cdcgov/wastewater-informed-covid-forecasting/
source: https://github.com/cdcgov/wastewater-informed-covid-forecasting/blob/HEAD/cfaforecastrenewalww/
2 changes: 1 addition & 1 deletion cfaforecastrenewalww/man/add_pmfs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion cfaforecastrenewalww/man/cfaforecastrenewalww-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions cfaforecastrenewalww/man/compile_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cfaforecastrenewalww/man/dot-do_1_pps_analysis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading