Skip to contents

function to estimate amount of events already started by not yet notified. The main use is to estimate how many cases in a outbreak has already started their onset date of symptons but has not yet notified. nowcasting_inla, fits a statistical distribution to the empirical distribution of time of delay between onset date and report date.

Usage

nowcasting_inla(
  dataset,
  bins_age = "SI-PNI",
  trim.data = 0,
  Dmax = 15,
  wdw = 30,
  age_col,
  date_onset,
  date_report,
  data.by.week = FALSE,
  silent = F,
  K = 0,
  trajectories = F,
  zero_inflated = F,
  ...
)

Arguments

dataset

Dataset with at least 2 columns, date of onset, date of report. It can be a dataset with 3 columns, two dates columns as before said and a another one being an stratum column, in which data will stratified, usually being age.

bins_age

Age bins to do the nowcasting, it receive a vector of age bins, or options between, "SI-PNI", "10 years", "5 years". Default "SI-PNI".

trim.data

(in weeks) Date to be trimmed out from the data base, in days. Default 0 days.

Dmax

(in weeks) Window of dates the estimation will act, i.e., till how many past weeks the nowcasting will estimate. Default 15 weeks.

wdw

(in weeks) Until which maximum amount of weeks the Nowcasting will use to the estimation. Default 30 weeks.

age_col

Column for ages

date_onset

Column of dates of onset of the events, normally date of onset of first symptoms of cases

date_report

Column of dates of report of the event, normally date of digitation of the notification of cases

data.by.week

If it has to be returned the whole time-series data. Default FALSE.

silent

Deprecated Should be the warnings turned off? Default is TRUE.

K

(in weeks) How much weeks to forecast ahead? Default K is 0, no forecasting ahead

trajectories

Returns the trajectories estimated on the inner 'INLA' model

zero_inflated

Experimental In non-structured models, fit a model that deals with zero-inflated data. Default FALSE. If the age_col is not missing this flag is ignored.

...

list parameters to other functions

return.age

Deprecated If the estimate by Age should be returned. Default TRUE.

Value

a list of 2 elements, each element with a data.frame with nowcasting estimation, 'Total', 'data' with the time-series out of wdw . If 'age_col' is parsed, add a thrid element with by age estimation 'age' . If 'trajectories' = TRUE, add a forth element with the returned trajectories from 'inla'.

Examples

# Loading Belo Horizonte SARI dataset
data(sragBH)
nowcasting_inla(dataset = sragBH,
                date_onset = DT_SIN_PRI,
                date_report = DT_DIGITA,
                silent = T)
#> Joining, by = "date_onset"
#> Joining, by = c("date_onset", "delay", "Time")
#> `summarise()` has grouped output by 'Time', 'dt_event'. You can override using
#> the `.groups` argument.
#> $total
#> # A tibble: 15 × 7
#>     Time dt_event   Median    LI    LS   LIb   LSb
#>    <int> <date>      <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1    17 2021-12-13    625  621   633   623   627 
#>  2    18 2021-12-20    695  687   708   692   699 
#>  3    19 2021-12-27    812  801   829   808.  817 
#>  4    20 2022-01-03    886  871   908   880   893 
#>  5    21 2022-01-10    818  800   846   810   826 
#>  6    22 2022-01-17    631  609   660   623   640 
#>  7    23 2022-01-24    542  517   575   532   552 
#>  8    24 2022-01-31    434  406   473   424   445 
#>  9    25 2022-02-07    422  389   465   409   434 
#> 10    26 2022-02-14    356  321   405   343   371.
#> 11    27 2022-02-21    334  291.  393.  316   351 
#> 12    28 2022-02-28    340  286   414.  321   364 
#> 13    29 2022-03-07    307  244.  402.  283   335 
#> 14    30 2022-03-14    280  190   438.  245   322 
#> 15    31 2022-03-21    229  116.  471.  181   287 
#>