Aggregate individual trajectory timeseries or forecasts to quantile timeseries or forecasts
Source:R/trajectories_to_quantiles.R
trajectories_to_quantiles.Rd
Given a tidy data frame of trajectories, aggregate it to a quantile timeseries for the given quantile values
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) in
trajectories
that identifies unique timepoints. Defaulttimepoint
.- 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. Defaultvalue
.- 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. alocation
column iftrajectories
contains trajectories over the same time period for multiple locations, such as different US States and Territories. If NULL, ignored. Default NULL.