Skip to contents

A feature-rich-ish graph plotting function, which can show the stochastic line for an outcome for different runs, the mean, median and quantiles. If two scenarios are specified, then the burden difference between scenarios is plotted. Additionally, if multiple groups or multiple touchstones are specified, then separate graphs with the same scaling are plotted to allow comparison.

Usage

stone_stochastic_graph(
  base,
  touchstones,
  disease,
  groups,
  country,
  scenarios,
  outcome,
  xaxis = "time",
  filter = NULL,
  by_cohort = FALSE,
  log = FALSE,
  packit_id = NULL,
  packit_file = NULL,
  include_stochastics = TRUE,
  include_quantiles = TRUE,
  include_mean = TRUE,
  include_median = TRUE
)

Arguments

base

The root folder in which the standardised stochastic files are found. Within it should be folders with touchstone names.

touchstones

A touchstone to plot, or a pair of touchstones to compare. If a pair, then only one modelling group can be specified below.

disease

The disease to display.

groups

The modelling group to plot, or a pair of modelling groups to be compared, in which case, only one touchstone can be specified.

country

The country to plot.

scenarios

A scenario to plot data for, or a pair of scenarios in which case we plot the outcome for the first scenario, subtract the second.

outcome

The outcome to plot, for example deaths, cases, dalys or since 2023, yll.

xaxis

The default is "time", meaning the x-axis is either calendar year, or birth cohort, depending on the by_cohort parameter. This means and age gets filtered by the filter parameter, and then aggregated. Alternatively, if set to "age", then age will be on the x-axis, and the filter parameter specifies either the years, or the birth cohorts to select (depending on the by_cohort parameter), before aggregation.

filter

Filter either ages, years, or birth cohort years to a range - see the comments above on the xaxis parametern. The filter is a vector of ages, or years, or can be NULL to do no filtering.

by_cohort

If TRUE, then age is subtracted from year to convert it to year of birth before aggregating. See the xaxis and filter parameters.

log

If TRUE, then use a logged y-axis.

packit_id

If set, then read central burden estimates from a file within a packit on the Montagu packit server.

packit_file

Used with packit_id to specify the filename of an RDS file providing burden estimates. We expect to find scenario, year, age, country, burden_outcome and value fields in the table.

include_stochastics

Default TRUE, select whether to draw the individual stochastic lines.

include_quantiles

Default TRUE, select whether to plot the 5% and 95% quantile lines.

include_mean

Default TRUE, select whether to plot the mean.

include_median

Default TRUE, select whether to plot the median.

Details

Graphs can have calendar year or birth cohort on the y-axis for time-series plots, in which case age is aggregated and the ages to be included can be specified. Alternatively, the x-axis can be age aggregated over time, where the calendar years to be aggregated can be specified.

Finally, it can also include a central estimate provided as a file within a packit, from the montagu reporting portal.