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,
  use.epiweek = FALSE,
  age_col,
  date_onset,
  date_report,
  data.by.week = FALSE,
  return.age = NULL,
  silent = F,
  K = 0,
  trajectories = F,
  zero_inflated = F,
  timeREmodel = "rw2",
  INLAoutput = F,
  INLAoutputOnly = F,
  WAIC = F,
  DIC = 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". The default is "SI-PNI".

trim.data

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

Dmax

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

wdw

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

use.epiweek

If TRUE, it uses the CDC epiweek definition where the week starts on Sunday, if FALSE it the week ends at the weekday of the last record date. Default is FALSE

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 is FALSE.

return.age

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

silent

Deprecated. Should be the warnings turned off? . The default is TRUE.

K

(in weeks) How much weeks to forecast ahead? . The default is K = 0, no forecasting ahead

trajectories

Returns the trajectories estimated from the inner 'INLA' model . The default is FALSE.

zero_inflated

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

timeREmodel

Latent model for time random effects. . The default is a second-order random walk model.

INLAoutput

return the INLA output. Default is FALSE.

INLAoutputOnly

return the only the INLA output. Default is FALSE.

WAIC

return the WAIC. The default is FALSE.

DIC

return the DIC.The default is FALSE.

...

list parameters to other functions

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 third element with by age estimation 'age' . If 'trajectories' = TRUE, add a forth element with the returned trajectories from 'inla'. If 'INLAoutput' = TRUE, the INLA output is returned as a list object named 'output'. If 'INLAoutputOnly' = TRUE, just the INLA output is returned in a list object named 'output'. If 'WAIC' = TRUE or 'DIC' = TRUE, then 'INLAoutput' is forced to be TRUE returning the INLA output and a list object named waic or dic are also returned.

Examples

# Loading Belo Horizonte SARI dataset

data(sragBH)

output <- nowcasting_inla(dataset = sragBH,
                date_onset = DT_SIN_PRI,
                date_report = DT_DIGITA,
                silent = TRUE)
#> Joining with `by = join_by(date_onset)`
#> Joining with `by = join_by(date_onset, delay, Time)`

tail(output$total)
#> # A tibble: 6 × 7
#>    Time dt_event   Median    LI    LS   LIb   LSb
#>   <int> <date>      <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1    26 2022-02-14   404   366   458   390   421 
#> 2    27 2022-02-21   336   295   403.  321   355.
#> 3    28 2022-02-28   301   243   374.  280   323 
#> 4    29 2022-03-07   312   244   419.  287   339.
#> 5    30 2022-03-14   283   196   458.  248.  332 
#> 6    31 2022-03-21   252.  129.  521.  203   312