Skip to contents

Forecast

Functions for forecasting across models, dates, and scenarios.

forecast()
Forecast using branching processes at a target date
forecast_across_dates()
Forecast across multiple dates
forecast_across_scenarios()
Forecast across multiple scenarios and dates
forecast_n_strain()
Forecast for a single model and summarise
plot(<fv_forecast>)
Plot method for forecast
summary(<fv_forecast>)
Summary method for forecast
unnest_posterior()
Unnest posterior estimates from a forecast data.frame

Model

Functions for fitting the forecasting models.

fv_as_data_list()
Format data for use with stan
fv_inits()
Set up initial conditions for model
fv_model()
Load and compile a strain model
fv_sample()
Fit a brancing process strain model

Preprocess

Functions for preprocessing observations.

filter_by_availability()
Filter data based on availability and forecast date
fv_dow_period()
Calculate the day of the week periodicity
latest_obs()
Filter for latest observations of all types
piecewise_steps()
Calculate piecewise steps

Postprocess

Functions for postprocessing model output.

convert_to_stanfit()
Convert to stanfit object
extract_draws()
Extract posterior draws
extract_forecast_dates()
Extract forecast dates
fv_extract_forecast()
Extract forecasts from a summarised posterior
fv_posterior()
Summarise the posterior
fv_tidy_posterior()
Summarise the posterior tidily
link_dates_with_posterior()
Link dates by time for posterior parameter estimates
link_obs_with_posterior()
Link posterior estimates with observed data
plot(<fv_posterior>)
Plot method for fv_tidy_posterior
print(<fv_posterior>)
Print method for fv_tidy_posterior
quantiles_to_long()
Convert summarised quantiles from wide to long format
summary(<fv_posterior>)
Summary method for fv_tidy_posterior
update_voc_label()
Label the Variant of Concern

Plot

Functions for plotting postprocessed forecast model output.

add_forecast_dates()
Add the forecast dates to a plot
plot(<fv_forecast>)
Plot method for forecast
plot(<fv_posterior>)
Plot method for fv_tidy_posterior
plot_cases()
Plot the posterior prediction for cases
plot_default()
Default posterior plot
plot_growth()
Plot the posterior prediction for the growth rate
plot_pairs()
Pairs plot of parameters of interest and fitting diagnostics
plot_posterior()
Plot posterior predictions
plot_rt()
Plot the posterior prediction for the reproduction number
plot_theme()
Add the default plot theme
plot_voc_advantage()
Plot the posterior prediction for the transmission advantage for the variant of concern
plot_voc_frac()
Plot the population posterior prediction for the fraction of samples with the variant of concern
save_plots()
Save plots by name

Model validation

Functions for validating model fits and forecasts.

bp_launch_shinystan()
Launch shinystan
fv_score_forecast()
Evaluate forecasts using proper scoring rules
plot_pairs()
Pairs plot of parameters of interest and fitting diagnostics

Generate data

Functions for generating simulated data.

generate_obs()
Generate Simulated Observations
sample_sequences()
Sample Sequence Observation Model

Define and generate scenarios

Functions for defining and generating data scenarios.

define_scenarios()
Define data availability scenarios
generate_obs_scenario()
Define observed data for a scenario
update_obs_availability()
Update observations based on availability

Datasets

Package datasets used in examples and by users to explore the package functionality.

fv_example()
Load a package example
germany_covid19_delta_obs
Test positive COVID-19 cases and sequences in Germany

Check inputs

Functions to check the structure of user inputs.

check_dataframe()
Check a data.frame
check_observations()
Check observations are in the correct format
check_param()
Check a parameter is the correct type and length
check_quantiles()
Check Quantiles Required are Present