consecutive_growth_warnings: Create a tsd_growth_warning object to count consecutive...

View source: R/consecutive_growth_warnings.R

consecutive_growth_warningsR Documentation

Create a tsd_growth_warning object to count consecutive significant observations

Description

This function calculates the number of consecutive significant ("growth_warning") observations, grouping them accordingly. The result is stored in an S3 object of class tsd_threshold.

Uses data from a tsd_onset object (output from seasonal_onset()).

seasonal_onset() has to be run with arguments;

  • season_start

  • season_end

  • only_current_season = FALSE

Usage

consecutive_growth_warnings(onset_output)

Arguments

onset_output

A tsd_onset object returned from seasonal_onset().

Value

An object of class tsd_growth_warning, containing; A tibble of processed observations, the significant_counter column specifies when a sequence of significant observation starts and ends. The first number is how many subsequent observations will be significant.

Examples

# Generate simulated data of seasonal waves
sim_data <- generate_seasonal_data(
  years = 5,
  start_date = as.Date("2022-05-26"),
  trend_rate = 1.002,
  noise_overdispersion = 2,
  relative_epidemic_concentration = 3
)

# Estimate seasonal onset
tsd_onset <- seasonal_onset(
  tsd = sim_data,
  family = "quasipoisson",
  season_start = 21,
  season_end = 20,
  only_current_season = FALSE
)

# Get consecutive significant observations
consecutive_growth_warnings(tsd_onset)

aedseo documentation built on April 12, 2025, 1:35 a.m.