This function takes as input bootstrapped values: Re estimates or others and builds uncertainty intervals from these bootstrapped values.

summarise_uncertainty(
  bootstrapped_values,
  original_values = NULL,
  uncertainty_summary_method = "original estimate - CI from bootstrap estimates",
  value_col = "Re_estimate",
  output_value_col = "Re_estimate",
  bootstrap_id_col = "bootstrap_id",
  index_col = "idx",
  ...
)

Arguments

bootstrapped_values

Bootstrap replicates of the original data. Must be a dataframe in the long format with a timestep index column named index_col, a bootstrap replicate index column named bootstrap_id_col, and a value column named value_col. The index column must not contain any NA value.

original_values

Optional. Values of reference used to construct the uncertainty interval around. Typically, these are estimates obtained on the original data. Must be a dataframe with a timestep index column named index_col and a value column named value_col. The index column must not contain any NA value.

uncertainty_summary_method

One of these options:

  • 'original estimate - CI from bootstrap estimates'. The confidence interval is built using bootstrapped estimates and centered around the original estimates.

  • 'bagged mean - CI from bootstrap estimates'. The confidence interval is built using bootstrapped estimates and centered around the mean of bootstrapped estimates and original estimates.

value_col

string. Name of the column containing values.

output_value_col

string. Name of the output column with estimated values.

bootstrap_id_col

string. Name of the column containing bootstrap samples numbering. Id 0 must correspond to values associated to the original data.

index_col

string. Name of the index column. The index tracks which data point in bootstrapped values corresponds to which data point in the original values.

...

Arguments passed on to .summarise_CI_bootstrap

central_values

Values around which the confidence interval is going to be centered. Must be a dataframe with a timestep index column named index_col and a value column named value_col. The index column must not contain any NA value.

alpha

value between 0 and 1. Confidence level of the confidence interval.

prefix_up

string. prefix to add to output_value_col to name the column containing the upper limit of confidence interval

prefix_down

string. prefix to add to output_value_col to name the column containing the lower limit of confidence interval

Value

A dataframe containing Re estimates (column 'Re_estimate') and confidence interval boundaries, with 4 columns like so:

  • index_col, the timestep index column

  • A column named output_value_col, containing the central values (typically these are Re estimates)

  • CI_up, upper limit of the confidence interval

  • CI_down, the lower limit of the confidence interval

Details

This function is not meant to be needed by regular users. It is exported as it can be useful when building 'pipes': sequences of computations that weave together the different modules provided by estimateR.