Skip to contents

Plot predicted trends

Usage

plot_trend(
  raw_indices = NULL,
  model_indices = fitted_data,
  pred_indices = preds_sm,
  start_yr = 2014,
  end_yr = 2022,
  ref_yr = 2014,
  targets = NULL,
  set_upperlimit = TRUE,
  upperlimit = 1.5,
  annual_variation = FALSE
)

Arguments

raw_indices

tibble with raw annual index value of observed data columns = year, index, index_q_0.25 = 2.5% confidence interval and index_q_0.975 = 97.5 % confidence interval. If raw indices are unavavilable these will be generated based on 5 and 95 percent range

model_indices

tibble of estimated indices drawn from fit_* function. Columns are draw, year, and proj_y

pred_indices

datatable with modeled and projected values into the future

start_yr

numeric value of the first year in which trend will be calculated. Default is first available year within the dataset

end_yr

numeric value representing the last year in which trend will be calculated. Default is first available year within the dataset

ref_yr

numeric value representing the reference year in which trends are compared to, default is 2014 for pif calculations

targets

optional tibble of short and term targets generated by get_targets()

set_upperlimit

logical default is TRUE. Should the upper limit of the plot be restricted to some function of the range of the original data (only relevant when projections are strongly positive)

upperlimit

numeric default is 1.5, The factor increase above the highest upper credible limit of the annual values of either the raw_indices or model_indices

annual_variation

logical plot the projections that capture some of the annual variation in rate of change. If FALSE (default), then a single mean projection and uncertainty bound are plotted, if TRUE and pred_indices represent a collection of annual projections (i.e., trends were estiamted using get_trend(..., annual_variation = TRUE)), then multiple annual projections will be plotted, each with an associated uncertainty bound. For example, if start_yr = 2012 and end_yr = 2022, then there will be 10 sets of annual trend projections (2012:2013, 2013:2014, etc.)

Value

plot

Examples

if (FALSE) { # \dontrun{
  hgams_plot <- plot_trend(raw_indices = input_option_1, model_indices = ldf_hgam,
  pred_indices = preds_hgam, start_yr = 2014, end_yr = 2022)
} # }