Skip to contents

All functions

add_pmfs()
Add probability mass functions
aggregate_ww()
Aggregate the WW data to the state-level
boxplot_whiskers()
Get the upper and lower ends of the whiskers of a single boxplot of data in x
categorical_entropy()
Entropy of sample from categorical distribution
cleanup_secrets()
Cleans up environment when secrets and API information is no longer needed
compile_model()
Compile a stan model while pointing at the package default include directory (stan) for #include statements
convert_to_logmean()
Convert to logmean in lognorm distribution
convert_to_logsd()
Convert to logsd in lognormal distribution
create_dir()
Create a new directory if one doesn't exist
drop_first_and_renormalize()
Drop the first element of a simplex
entropy()
Entropy of probability mass function p
example_df
Input dataframe for fitting the site-level infection dynamics wastewater model
example_params
Example model parameters and hyperparameters for priors
fit_aggregated_model()
Fit aggregated model
fit_model()
Fit site level model
fit_site_level_model()
Fit site-level model
flag_ww_outliers()
Flag WW outliers
format_hosp_draws_hub_sub()
Prepare posterior draws of hospital admissions for the COVID-19 forecast hub
generate_simulated_data()
Generate simulated data from the underlying model's generative process
get_all_quantiles()
Get all quantiles
get_all_training_data()
Get long tibble of data needed for model fitting
get_combo_quantile_plot()
Title
get_config_vals()
Read in the config yaml and add run-specific dynamic configuration to it.
get_df_for_hub_submission()
Load in future hosp draws and combine into a single dataframe
get_df_of_filepaths()
This code was adapted from code written (under an MIT license) as part of the epinowcast package (https://github.com/epinowcast/epinowcast) Get dataframe of filepaths
get_diagnostics()
Get a data frame of data and model fit diagnostics
get_figure_file_path()
Get the figure file path
get_figure_output_subdirectory()
Get the path to the subdirectory in which to save figures for a given top-level output directory
get_full_param_distrib()
Get full parameter distribution
get_gen_quants_draws()
Get generated quantities draws site level model
get_generated_quantities_draws()
Get generated quantities draws
get_generation_interval_gamma()
Get the generation interval from a gamma distribution
get_generation_interval_lnorm()
Get the generation interval from a lognormal distribution
get_hosp_data()
Gets hospitalization data that model will be trained on
get_hosp_reporting_delay()
Get the hospital reporting delay
get_ind_m()
Get index matrix
get_ind_m_cum_sum()
Get index matrix
get_init_fun()
Get initialization function for stan
get_loc_model_map()
Get location to model map
get_location_notes_table()
Get a table that records notes on data characteristics and model choices for individual locations, e.g. the absence of recent wastewater observations or the decision to publish the hospital admissions only model
get_low_case_count_diagnostic()
Calculate low case count diagnostic flag
get_metadata()
Get metadata from a single group training data
get_metadata_yaml()
Create YAML formatted metadata file listing states without wastewater data, states with insufficient wastewater data, and states for which we used the hospital admissions only model.
get_model_file_name()
Get shortened name for writing a file with model file name
get_model_file_path()
Get path to stan wastewater model
get_model_param_df()
Information about a ww model's parameters and generated quantities
get_model_run_diagnostics()
Get the parameters that were flagged for diagnostics for the model run
get_nearest_forecast_date()
Local functions that are used to pre-process our specific data for use in the stan model These will be used to get the data up to the point it needs to be in the get_stan_data functions, which format the data into the stan lists that the stan model needs. None of these will be exported Get forecast date from today's date
get_param_samples_long_df()
Get full parameter distribution
get_parameter_draws()
Get posterior parameter draws and summary stats
get_params()
Get parameters for model run
get_pars()
Get parameters
get_pdf_file_path()
get the cleaned pdf filepath
get_pdf_output_subdirectory()
Get the path to the subdirectory in which to save summary output for a given top-level output directory.
get_pipeline_metadata()
Assemble pipeline metadata for a given run, returning it as a list and writing it to disk as a YAML file.
get_plot_change_in_p_hosp_t()
Get plot of the change in IHR over time
get_plot_covidhub_submission()
Get plot COVID hub submission
get_plot_draws()
Plot of draws for a single forecast date, with optional groupings
get_plot_labsite_ww_draws()
Plot of lab-site level wastewater draws
get_plot_metadata()
Get the metadata needed for plotting
get_plot_p_hosp_t()
Get plot of IHR(t)
get_plot_param_distribs()
Get plot of parameter distributions
get_plot_single_param()
Get plot single parameter
get_ppa_long()
Reformats output of posterior_predictive_analysis() into something more easily usable
get_prior_pred_hosps_df()
Observables extraction from prior predictive samples
get_prior_pred_ww_df()
Observables extraction from prior predictive samples
get_quantiles()
Get the quantiles being used
get_quantiles_on_site_level_ww()
Quantile the site level expected observed WW
get_random_string()
Get a random string of length 8 containing 3 letters, 4 digits, 1 letter
get_raw_param_draws()
Get raw parameter draws
get_regions_for_mapping()
: get states mapped to their regions
get_relative_forecast_dir()
Hardcoded figure filepath for figures per the read me
get_repo_forecast_file_path()
Get the filepath to save the forecasts within this repo
get_rt_boxplot_across_states()
Get R(t) box plot across states
get_rt_from_draws()
Get R(t) for a single location
get_rt_site_level()
Plot of site-level Rt
get_rt_subpop_level()
Plot of site-level Rt
get_scores()
Get scores
get_secret()
Interface for getting information needed for API interfacing
get_site_county_map()
Get site county mapp
get_stan_data()
Get stan data
get_stan_data_site_level_model()
Get stan data site level model
get_state_level_hosp_data()
Get raw hospitalization data
get_state_level_summary()
Get summary of WW viral concentrations by state
get_submission_file_path()
Get the hardcoded submission file path
get_submission_filepath_df()
Get a consolidated dataframe with each location and its corresponding file path for the necesary outputs.
get_summarized_table()
Get summarized table with each location and
get_summary_stats()
Get sumamry stats of diagnostics
get_testing_data()
Get testing dataset
get_training_data()
Get dataframe with wastewater and hospitalizaiton data for training the model
get_wastewater_diagnostic()
Get some basic flags on the wastewater data, for internal use and for reporting out in our metadata
get_weekly_summary()
Summarize data into weekly by site
get_ww_data()
Get the watstewater data for a particular source and geographic granularity
get_ww_site_plots()
Plot of lab-site level wastewater quantiles
init_subset_nwss_data()
Initial subsetting of NWSS data
loc_abbr_to_flusight_code()
Convert a two-letter location abbreviation to a two-character FluSight location code
log_standardize()
As standardize, but on log scale, possibly removing zeros (or near-zeros)
make_hospital_onset_delay_pmf()
Make hospital onset delay pmf
make_incubation_period_pmf()
Make incubation period pmf
make_pps_data()
Gets generated quantites from a fitted ww model and formats for stan
make_reporting_delay_pmf()
Make reporting delay pmf
manual_removal_of_hosp_data()
Manual removal of hopsital admissions data points in particular states
max_delta()
Maximum finite difference of x
nhsn_soda_query()
Construct a Socrata open data API (SODA) query for the NSHN dataset
param_df
Input parameters used to generate example_df
pivot_data_for_plotting()
Pivot the quantiles output for easy plotting
plot_combined_data()
Plot the WW and hospitalization data together
plot_quantiles()
Plot a timeseries of quantiles
posterior_predictive_analysis()
Runs posterior- and prior--predictive analyses and returns summaries of performance
prior_predictive_check()
Draws data under the model's prior.
pull_nhsn()
Pull NHSN data from HealthData.gov
read_diagnostics_df()
Load in and combine all the diagnostic tables
render_diagnostic_report()
Render diagnostic report
save_timestamped_nwss_data()
Save time stampped NWSS data
save_to_pdf()
Save a single pdf of plots
setup_secrets()
Handles values needed to retrieve data from APIs to run pipeline
simulate_double_censored_pmf()
Simulate daily double censored PMF. From epinowcast: https://package.epinowcast.org/dev/reference/simulate_double_censored_pmf.html
site_level_inf_inits()
Get initialization function for stan for site-level infection model
soql_is_in()
Return a soql::soql_where() construct for a given column being in a list of values
standardize()
x -> (x - location(x))/dispersion(x) location is mean, dispersion is SD or MAD
state_agg_inits()
Get initialization function for stan for aggregated model
subsample_sites()
Subsample wastewater sites
summarize_scores()
Summarize scores
trajectories_to_quantiles()
Aggregate individual trajectory timeseries or forecasts to quantile timeseries or forecasts
validate_paramlist()
Validate a parameter list
varies()
Is there any variation in x?
ww_model()
This code was adapted from code written (under an MIT license) as part of the `epinowcast` package (https://github.com/epinowcast/epinowcast) ww_model
zoom_boxplot_y()
Get y range required to zoom a boxplot in to ignore outliers df is the data, x the grouping variable, y the variable to be boxplotted