Skip to contents

[Stable] Defines a list specifying the structure of the observation model. Custom settings can be supplied which override the defaults.

Usage

obs_opts(
  family = "negbin",
  phi = c(0, 1),
  weight = 1,
  week_effect = TRUE,
  week_length = 7,
  scale = list(),
  likelihood = TRUE,
  return_likelihood = FALSE
)

Arguments

family

Character string defining the observation model. Options are Negative binomial ("negbin"), the default, and Poisson.

phi

A numeric vector of length 2, defaults to 0, 1. Indicates the mean and standard deviation of the normal prior used for the observation process.

weight

Numeric, defaults to 1. Weight to give the observed data in the log density.

week_effect

Logical defaulting to TRUE. Should a day of the week effect be used in the observation model.

week_length

Numeric assumed length of the week in days, defaulting to 7 days. This can be modified if data aggregated over a period other than a week or if data has a non-weekly periodicity.

scale

List, defaulting to an empty list. Should an scaling factor be applied to map latent infections (convolved to date of report). If none empty a mean (mean) and standard deviation (sd) needs to be supplied defining the normally distributed scaling factor.

likelihood

Logical, defaults to TRUE. Should the likelihood be included in the model.

return_likelihood

Logical, defaults to FALSE. Should the likelihood be returned by the model.

Value

A list of observation model settings.

Author

Sam Abbott

Examples

# default settings
obs_opts()
#> $family
#> [1] "negbin"
#> 
#> $phi
#> [1] 0 1
#> 
#> $weight
#> [1] 1
#> 
#> $week_effect
#> [1] TRUE
#> 
#> $week_length
#> [1] 7
#> 
#> $scale
#> list()
#> 
#> $likelihood
#> [1] TRUE
#> 
#> $return_likelihood
#> [1] FALSE
#> 

# Turn off day of the week effect
obs_opts(week_effect = TRUE)
#> $family
#> [1] "negbin"
#> 
#> $phi
#> [1] 0 1
#> 
#> $weight
#> [1] 1
#> 
#> $week_effect
#> [1] TRUE
#> 
#> $week_length
#> [1] 7
#> 
#> $scale
#> list()
#> 
#> $likelihood
#> [1] TRUE
#> 
#> $return_likelihood
#> [1] FALSE
#> 

# Scale reported data
obs_opts(scale = list(mean = 0.2, sd = 0.02))
#> $family
#> [1] "negbin"
#> 
#> $phi
#> [1] 0 1
#> 
#> $weight
#> [1] 1
#> 
#> $week_effect
#> [1] TRUE
#> 
#> $week_length
#> [1] 7
#> 
#> $scale
#> $scale$mean
#> [1] 0.2
#> 
#> $scale$sd
#> [1] 0.02
#> 
#> 
#> $likelihood
#> [1] TRUE
#> 
#> $return_likelihood
#> [1] FALSE
#>