Learn R Programming

gsClusterDetect (version 1.0.0)

generate_case_grids: Get candidate clusters and locations in baseline intervals

Description

Given raw case counts by location, and some dates and other params return candidate clusters and counts

Usage

generate_case_grids(
  cases,
  detect_date,
  baseline_length = 90,
  max_test_window_days = 7,
  guard_band = 0,
  baseline_adjustment = c("add_one", "add_one_global", "add_test", "none"),
  adj_constant = 1
)

Value

an object of class `CaseGrids` contain a list of items

  • `baseline_counts_by_location`: a frame of counts over the baseline interval by location

  • `case_grid`: a frame of cases during the test dates, with reverse cumulative counts within location, by date

  • `case_grid_totals_by_date`: reverse cumulative sum of counts over all locations, by date

  • `test_cases`: case location counts only during the test dates

  • `detect_date`: the detect date passed to this function

  • `baseline_total`: an integer holding the total counts over all locations and dates

Arguments

cases

frame of cases with counts, location(s) and dates

detect_date

date to end examination of detection of clusters

baseline_length

number of days (integer) used for baseline detection (default = 90)

max_test_window_days

integer, max number of days in a detected cluster, defaults to 7

guard_band

integer (default=0) number of days buffer between test interval and baseline

baseline_adjustment

one of three string options: "add_one" (default), "add_test", or "none". All methods except for "none" will ensure that the log(obs/expected) is always defined (i.e. avoids expected =0). For the default, this will add 1 to the expected for any individual calculation if expected would otherwise be zero. For "add_test_interval", each location in the baseline is increased by the number of cases in that location during the test interval. If "none", no adjustment is made.

adj_constant

numeric (default=1.0); this is the constant to be added if baseline_adjustment == 'add_one' or baseline_adjustment == 'add_one'

Examples

Run this code
dd <- example_count_data[, max(date)]
generate_case_grids(
  cases = example_count_data,
  detect_date = dd
)

Run the code above in your browser using DataLab