Skip to contents

Constructs a model formula object for detecting excess counts using various model types, such as Mean, Harmonic, Farrington-Noufaily, Custom, MultiState, and Splines.

Usage

excodeFormula(
  name,
  S = 1,
  timepoints_per_unit = 52,
  noPeriods = 10,
  w = 3,
  timeTrend = TRUE,
  intercept = TRUE,
  data = NULL,
  df_season = 4,
  df_trend = 1,
  nStates = NULL,
  shared_params = FALSE,
  offset = FALSE
)

Arguments

name

Character. Name of the model. Must be one of c("Mean", "FarringtonNoufaily", "Harmonic", "Custom", "MultiState").

S

Integer. Number of oscillations during one year for Harmonic models. Default is 1.

timepoints_per_unit

An integer giving the number of time points within one time unit. For example, use 52 for weekly data over a year, 7 for daily data with weekly cycles, or 365 for daily data with annual cycles. The default is 52.

noPeriods

Integer. Number of levels in the factor which creates bins in each year to model seasonal patterns. Only used in 'FarringtonNoufaily' models. Default is 10.

w

Integer. The number of weeks before and after the current week to include in the bin which contains the respective week in each year. Only used in 'FarringtonNoufaily' models. Default is 3.

timeTrend

Logical. Indicates whether a time trend should be included in the model. Used in 'Mean', 'Harmonic' and 'FarringtonNoufaily' models. Default is TRUE.

intercept

Logical. TRUE if the model should include an intercept, FALSE otherwise. Only used with 'MultiState' models.Default is TRUE.

data

data.frame. A data.frame containing variables which are used to model case counts. All variables in the data.frame will be used in the model. The data.frame has to have the same number of rows as time points in the time series. Default is NULL.

df_season

Integer. Degrees of freedom for spline modeling seasonality. This class uses cubic splines, which are not recommended to model periodic patterns. Only used for 'Splines' models. Default is 4.

df_trend

Integer. Degrees of freedom for spline modeling the time trend. Only used for 'Splines' models. Default is 1.

nStates

The number of states of the model. Default is NULL.

shared_params

Logical. Indicates whether model parameters are shared across multiple time series. Default is FALSE.

offset

Logical. Whether an offset should be included in the model. Default is FALSE.

Value

An S4 object of class excodeFormula representing the specified model formula.

See also

Examples


excode_formula_har <- excodeFormula("Harmonic")