Skip to contents

Generic to update a nowcaster object with new data

Usage

# S3 method for class 'nowcaster'
update(
  object,
  new_data,
  now = NULL,
  refresh = 250 * rlang::is_interactive(),
  ...
)

Arguments

object

A nowcaster object generated by nowcast()

new_data

New .disease_data to use for fitting nowcast(). Ideally this should include the previous data + new observations in the same data.frame.

now

An object of datatype Date indicating the date at which to perlform the nowcast.

refresh

Refresh parameter for rstan::sampling()

...

Additional arguments to pass to rstan::sampling()

Examples

# Load the data
data(denguedat)

# Run a nowcast using the first 1000 data points
first_1k <- denguedat[1:1000,]
ncast <- nowcast(first_1k, "onset_week", "report_week",
  method = "optimization", seed = 2495624, iter = 10, refresh = 0)
ncast
#> 
#> ── Nowcast for 1990-11-12 ──
#> 
#> • Column with `true_date` = "onset_week"
#> • Column with `report_date` = "report_week"
#> • units = "weeks"
#> 
#> ── Epidemic effects: 
#> The following effects are in place:
#>week_of_year
#> 
#> ── Delay effects: 
#> No temporal effects are considered
#> 
#> Use the `summary` function to obtain the summary of predictions or `plot` to
#> generate an image
#> 

#Update the nowcast now that new information was acquired
first_3k <- denguedat[1:3000,]
update(ncast, new_data = first_3k)
#> ── Nowcast for 1991-10-14 ──
#> 
#> • Column with `true_date` = "onset_week"
#> • Column with `report_date` = "report_week"
#> • units = "weeks"
#> 
#> ── Epidemic effects: 
#> The following effects are in place:
#>week_of_year
#> 
#> ── Delay effects: 
#> No temporal effects are considered
#> 
#> Use the `summary` function to obtain the summary of predictions or `plot` to
#> generate an image
#>