Skip to contents

Generate trend based based on multiple draws of annual indices

Usage

get_trend(proj_data, start_yr = NA, end_yr = NA, method = "gmean")

Arguments

proj_data

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

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 vlaue representing the last year in which trend will be calculated. Default is first available year within the dataset

method

character of method used to calculate trend. Two methods available; geometric mean ("gmean" as default )or "lm" linear regression

Value

tibble with estimated trend and percent_trend for each draw

Examples

if (FALSE) { # \dontrun{
 ldf_smooths <- tibble::rowid_to_column(fitted_smooths, "draw") %>%
      tidyr::pivot_longer(., cols = !starts_with("d")) %>%
      dplyr::rename('year' = name, "proj_y" = value)%>%
      dplyr::mutate(year = as.integer(year))
 trend_sm <- get_trend(ldf_smooths, start_yr = 2014, end_yr = 2022, method = "gmean")
} # }