Skip to contents

Run a conditional poisson model for a single geographic unit

Usage

condPois_1stage(
  exposure_matrix,
  outcomes_tbl,
  argvar = NULL,
  arglag = NULL,
  maxlag = NULL,
  min_n = 50,
  strata_min = 0,
  global_cen = NULL,
  multi_zone = FALSE,
  verbose = TRUE,
  truncate = 0.025
)

Arguments

exposure_matrix

a matrix of exposures, with columns for lag, usually created by make_exposure_matrix

outcomes_tbl

a data.table of outcomes, created by make_outcome_table

argvar

a list containing the argvar components for the crossbasis

arglag

a list containing the arglag components for the crossbasis

maxlag

an integer of the maximum lag

min_n

an integer describing the minimum number of cases for a single geo_unit

strata_min

an integer describing the minimum number of cases for a single strata

global_cen

global centering point

multi_zone

are multiple strata being used.

verbose

used to print crossbasis args the first time

truncate

proportion of the exposure distribution to trim from each tail when choosing the centering point (default 0.025)

Value

a condPois_1stage model object

Examples

exposure_columns <- list("date" = "date", "exposure" = "tmax_C",
                         "geo_unit" = "TOWN20", "geo_unit_grp" = "COUNTY20")
outcome_columns <- list("date" = "date", "outcome" = "daily_deaths",
                        "geo_unit" = "TOWN20", "geo_unit_grp" = "COUNTY20")
time_subset <- list(month = 5:9, year = 2012:2013)
exposure_mat <- make_exposure_matrix(subset(ma_exposure, TOWN20 == "BOSTON"),
                                     exposure_columns, time_subset = time_subset)
#> -- NA values automatically removed
#> strata dt_by = 'day', setting strata as geo_unit:yr:mn:dow
outcomes_tbl <- make_outcome_table(subset(ma_deaths, TOWN20 == "BOSTON"),
                                   outcome_columns, time_subset = time_subset)
#> Missing outcome values introduced by xgrid were set to 0;
#>             assumes that every time in the dataset should have an outcome value
#> strata dt_by = 'day', setting strata as geo_unit:yr:mn:dow
m <- condPois_1stage(exposure_mat, outcomes_tbl)
#> 
#> crossbasis args for geo_unit  BOSTON :
#> 
#> maxlag: 5 
#> 
#> argvar:
#> List of 2
#>  $ fun  : chr "ns"
#>  $ knots: Named num [1:2] 25.6 31.9
#>   ..- attr(*, "names")= chr [1:2] "50%" "90%"
#> 
#> arglag:
#> List of 2
#>  $ fun  : chr "ns"
#>  $ knots: num [1:2] 0.878 2.095
#> 
#> strata:
#> BOSTON:yr2012:mn05:dow03
#> strata_min: 0 
#> 
#> min_n: 50 
#> 
#> truncate final RR and basis cen:  0.025 
#> formula:
#>    daily_deaths ~ cb
#> family: quasipoisson