excessCases.Rd
excessCases
takes a time series of cases (daily or weekly) and fits a
harmonic baseline. There is also an option to import influenza data from
the CDC's NREVSS database and match it by state, or import Google search
queries for RSV for the respective state. Dummy variables adjust for
variations in average incidence between years, and interactions between
RSV or flu allow these effects to vary over time.
excessCases(ds, sub.statevar = "none", statevar = "state", agevar = "none", datevar, covs = character(), use.syndromes, denom.var, adj.flu = "none", adj.rsv = "none", time.res = "day", extrapolation.date = "2020-03-01")
ds | A data.frame, with a format similar to the one produced by the
|
---|---|
sub.statevar | A string. Which variable in the input data frame contains the local geography identifier (e.g., county, borough) |
statevar | A string. Which variable in the input data frame contains
the state (2-digit state; e.g. |
agevar | A string. Which variable in the input data frame contains the
age group? Use |
datevar | A string. Which variable in the input data frame contains the date? |
covs | A character vector. Which, if any, variables in |
use.syndromes | A vector with the variable names for syndromes to be
tested (e.g., |
denom.var | A string. Which variable on the input dataframe should be used as the denominator? For instance, all ED visits. |
adj.flu | A logical scalar. How should influenza be adjusted for when
fitting the seasonal baseline? Possible values are |
adj.rsv | A string. How should RSV be adjusted for when fitting the
seasonal baseline? Possible values are |
time.res | One of |
extrapolation.date | The model is fit up to this date, and then
extrapolated for all future dates. Defaults to |
flu.import | A logical scalar. Import the latest influenza testing data from the CDC NREVSS system? If TRUE, the data will be downloaded and merge with the input dataframe by state and week. the flu variable will be included in the regressionwhen fitting the baseline |
rsv.import | A logical scalar. Import weekly search volume for 'RSV' for the states in the input dataframe? This option can only be used if there are 5 or fewer states on the input dataset. This variable is included in the regression model when fitting the seasonal baseline. |
A list of lists with an entry for each syndrome, and sub-lists by age group and geography:
date
: vector of dates used in the model. Use the helper function
excessExtract
to pull out specific components and organize
them into an array
y
: array of observed values for the syndromes
resid1
: Observed/model fitted values
upi
: upper 95
lpi
: lower 95
sqrt.rsv
: RSV variale used in the model (if any)
log.flu
: flu variable used in the model (if any)
unexplained.cases
: observed-expected(fitted)
denom
: denominator used in the model
pred.var
: variance of the prediction interval
library(cdcfluview)#> Warning: package 'cdcfluview' was built under R version 3.6.3ili.data <- ilinet(region = c("state")) ili.data$state <- state.abb[match(ili.data$region, state.name)] ili.data <- ili.data[, c("state", "week_start", "ilitotal", "total_patients")] ili.data <- ili.data[ili.data$state %in% c("CA", "NY", "WA", "NJ", "CT"), ] excess_cases <- excessCases(ds = ili.data, datevar = "week_start", agevar = "none", statevar = "state", denom.var = "total_patients", use.syndromes = c("ilitotal"), time.res = "week")