Skip to contents

Makes a tidy summary dataframe of the results of the function nowcast()

Usage

# S3 method for class 'nowcaster'
summary(object, quantiles = c(0.05, 0.95), ...)

Arguments

object

A nowcaster object generated by nowcast()

quantiles

A vector specifying the quantiles to include in the summary

...

Additional options to pass to summary.

Value

A summary tibble of the nowcast results, it specifies: true date, strata, mean, standard deviation, median, and quantiles

Examples

# Load the data
data(denguedat)

# Run a nowcast with very few iterations
# change to method = "sampling" when working and remove the iter = 10
now <- as.Date("1990-10-01")

# perform nowcasting
ncast <- nowcast(denguedat, "onset_week", "report_week",
  now = now, method = "optimization",
  seed = 2495624, iter = 10
)

# create summary dataframe
summary(ncast)
#> # A tibble: 40 × 7
#>    onset_week  mean    sd median  `5%` `95%` Strata_unified
#>    <date>     <dbl> <dbl>  <dbl> <dbl> <dbl> <chr>         
#>  1 1990-01-01    61     0     61    61    61 No strata     
#>  2 1990-01-08    50     0     50    50    50 No strata     
#>  3 1990-01-15    44     0     44    44    44 No strata     
#>  4 1990-01-22    46     0     46    46    46 No strata     
#>  5 1990-01-29    39     0     39    39    39 No strata     
#>  6 1990-02-05    34     0     34    34    34 No strata     
#>  7 1990-02-12    24     0     24    24    24 No strata     
#>  8 1990-02-19    17     0     17    17    17 No strata     
#>  9 1990-02-26    17     0     17    17    17 No strata     
#> 10 1990-03-05    16     0     16    16    16 No strata     
#> # ℹ 30 more rows

# Specific quantiles can be requested
summary(ncast, quantiles = c(0.1, 0.2, 0.3, 0.4))
#> # A tibble: 40 × 9
#>    onset_week  mean    sd median `10%` `20%` `30%` `40%` Strata_unified
#>    <date>     <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <chr>         
#>  1 1990-01-01    61     0     61    61    61    61    61 No strata     
#>  2 1990-01-08    50     0     50    50    50    50    50 No strata     
#>  3 1990-01-15    44     0     44    44    44    44    44 No strata     
#>  4 1990-01-22    46     0     46    46    46    46    46 No strata     
#>  5 1990-01-29    39     0     39    39    39    39    39 No strata     
#>  6 1990-02-05    34     0     34    34    34    34    34 No strata     
#>  7 1990-02-12    24     0     24    24    24    24    24 No strata     
#>  8 1990-02-19    17     0     17    17    17    17    17 No strata     
#>  9 1990-02-26    17     0     17    17    17    17    17 No strata     
#> 10 1990-03-05    16     0     16    16    16    16    16 No strata     
#> # ℹ 30 more rows