Skip to contents

Given a tidy data frame of trajectories, aggregate it to a quantile timeseries for the given quantile values

Usage

trajectories_to_quantiles(
  trajectories,
  quantiles = c(0.01, 0.025, seq(0.05, 0.95, 0.05), 0.975, 0.99),
  timepoint_cols = "timepoint",
  value_col = "value",
  quantile_value_name = "quantile_value",
  quantile_level_name = "quantile_level",
  id_cols = NULL
)

Arguments

trajectories

tidy data frame or tibble of trajectories

quantiles

quantiles to output for each timepoint (default the FluSight/COVIDHub 2024-25 quantiles: c(0.01, 0.025, seq(0.05, 0.95, 0.05), 0.975, 0.99)

timepoint_cols

name of the column(s) intrajectories that identifies unique timepoints. Default timepoint.

value_col

name of the column in trajectories with the trajectory values (for which we wish to compute quantiles), e.g. hosp, weekly_hosp, cases, etc. Default value.

quantile_value_name

What to name the column containing quantile values in the output table. Default "quantile_value"

quantile_level_name

What to name the column containing quantile levels in the output table. Default "quantile_level"

id_cols

additional id columns in trajectories to group by before aggregating, e.g. a location column if trajectories contains trajectories over the same time period for multiple locations, such as different US States and Territories. If NULL, ignored. Default NULL.