Learn R Programming

gsClusterDetect (version 1.0.0)

generate_observed_expected: Generate the observed and expected information

Description

Function takes an object of class `NearbyClusterGrids`, as returned from gen_nearby_case_info(), and adds observed and expected information.

Usage

generate_observed_expected(
  nearby_counts,
  case_grid,
  adjust = FALSE,
  adj_constant = 1
)

Value

a dataframe of class `ObservedExpectedGrid`, which is simply a data frame with

Arguments

nearby_counts

an object of class `NearbyClusterGrids`

case_grid

an object of class `CaseGrids`

adjust

boolean default TRUE, set to FALSE to avoid adding one to the expected when it is zero. Could result in errors.

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
case_grid <- generate_case_grids(
  example_count_data,
  example_count_data[, max(date)]
)
nci <- gen_nearby_case_info(
  cg = case_grid,
  distance_matrix = county_distance_matrix("OH")[["distance_matrix"]],
  distance_limit = 25
)
generate_observed_expected(
  nearby_counts = nci,
  case_grid = case_grid
)

Run the code above in your browser using DataLab