Skip to contents

summary method for class "epinowcast".

Usage

# S3 method for epinowcast
summary(
  object,
  type = c("nowcast", "nowcast_samples", "fit", "posterior_prediction"),
  max_delay = object$max_delay,
  ...
)

Arguments

object

A data.table output from epinowcast().

type

Character string indicating the summary to return; enforced by base::match.arg(). Supported options are:

max_delay

Maximum delay to which nowcasts should be summarised. Must be equal (default) or larger than the modelled maximum delay. If it is larger, then nowcasts for unmodelled dates are added by assuming that case counts beyond the modelled maximum delay are fully observed.

...

Additional arguments passed to summary specified by type.

Value

A summary data.frame

See also

summary epinowcast

Other epinowcast: epinowcast(), plot.epinowcast()

Examples

nowcast <- enw_example("nowcast")

# Summarise nowcast posterior
summary(nowcast, type = "nowcast")
#>     reference_date report_date .group max_confirm location age_group confirm
#>             <IDat>      <IDat>  <num>       <int>   <fctr>    <fctr>   <int>
#>  1:     2021-08-03  2021-08-22      1         149       DE       00+     149
#>  2:     2021-08-04  2021-08-22      1         166       DE       00+     166
#>  3:     2021-08-05  2021-08-22      1         133       DE       00+     133
#>  4:     2021-08-06  2021-08-22      1         137       DE       00+     137
#>  5:     2021-08-07  2021-08-22      1         139       DE       00+     139
#>  6:     2021-08-08  2021-08-22      1          97       DE       00+      97
#>  7:     2021-08-09  2021-08-22      1          58       DE       00+      58
#>  8:     2021-08-10  2021-08-22      1         175       DE       00+     175
#>  9:     2021-08-11  2021-08-22      1         233       DE       00+     233
#> 10:     2021-08-12  2021-08-22      1         237       DE       00+     237
#> 11:     2021-08-13  2021-08-22      1         204       DE       00+     204
#> 12:     2021-08-14  2021-08-22      1         189       DE       00+     189
#> 13:     2021-08-15  2021-08-22      1         125       DE       00+     125
#> 14:     2021-08-16  2021-08-22      1          98       DE       00+      98
#> 15:     2021-08-17  2021-08-22      1         242       DE       00+     242
#> 16:     2021-08-18  2021-08-22      1         223       DE       00+     223
#> 17:     2021-08-19  2021-08-22      1         202       DE       00+     202
#> 18:     2021-08-20  2021-08-22      1         171       DE       00+     171
#> 19:     2021-08-21  2021-08-22      1         112       DE       00+     112
#> 20:     2021-08-22  2021-08-22      1          45       DE       00+      45
#>     reference_date report_date .group max_confirm location age_group confirm
#>     cum_prop_reported delay prop_reported    mean median         sd     mad
#>                 <num> <num>         <num>   <num>  <num>      <num>   <num>
#>  1:                 1    19   0.000000000 149.000    149   0.000000  0.0000
#>  2:                 1    18   0.000000000 167.426    167   1.318432  1.4826
#>  3:                 1    17   0.000000000 135.789    136   1.854162  1.4826
#>  4:                 1    16   0.000000000 141.288    141   2.378805  1.4826
#>  5:                 1    15   0.007194245 146.019    146   3.079630  2.9652
#>  6:                 1    14   0.000000000 103.853    104   2.969884  2.9652
#>  7:                 1    13   0.000000000  62.766     63   2.432110  2.9652
#>  8:                 1    12   0.000000000 185.035    185   3.847932  4.4478
#>  9:                 1    11   0.000000000 256.031    256   6.498790  5.9304
#> 10:                 1    10   0.004219409 267.692    267   7.713536  7.4130
#> 11:                 1     9   0.000000000 236.057    235   8.508004  7.4130
#> 12:                 1     8   0.015873016 231.407    231  10.083304 10.3782
#> 13:                 1     7   0.040000000 164.876    164   9.848127 10.3782
#> 14:                 1     6   0.010204082 128.858    128   8.134495  7.4130
#> 15:                 1     5   0.012396694 293.309    292  11.938427 11.8608
#> 16:                 1     4   0.017937220 293.042    292  15.799489 14.8260
#> 17:                 1     3   0.019801980 291.478    290  21.108128 19.2738
#> 18:                 1     2   0.070175439 293.178    291  29.440398 28.1694
#> 19:                 1     1   0.383928571 308.518    302  51.151522 46.7019
#> 20:                 1     0   1.000000000 375.644    363 103.424281 91.1799
#>     cum_prop_reported delay prop_reported    mean median         sd     mad
#>         q5   q20    q35   q50    q65   q80    q95      rhat  ess_bulk  ess_tail
#>      <num> <num>  <num> <num>  <num> <num>  <num>     <num>     <num>     <num>
#>  1: 149.00   149 149.00   149 149.00   149 149.00        NA        NA        NA
#>  2: 166.00   166 167.00   167 168.00   168 170.00 0.9997778 1003.5643  828.2026
#>  3: 133.00   134 135.00   136 136.00   137 139.00 1.0005878  991.0805  916.0962
#>  4: 138.00   139 140.00   141 142.00   143 146.00 1.0056729 1041.2029  872.9772
#>  5: 141.00   143 145.00   146 147.00   148 152.00 1.0001025  991.1639  885.1056
#>  6: 100.00   101 102.65   104 105.00   106 109.00 0.9991163  982.3833  917.3468
#>  7:  59.00    61  62.00    63  63.00    65  67.00 1.0009067  911.2098  793.6687
#>  8: 179.00   182 183.00   185 186.00   188 192.00 1.0002531 1004.7790  972.0392
#>  9: 246.00   251 253.00   256 258.00   261 268.00 0.9997137 1025.3311  936.5679
#> 10: 256.00   261 265.00   267 270.00   274 282.00 1.0004951 1040.1417 1008.8448
#> 11: 223.00   229 233.00   235 239.00   243 251.00 0.9985724 1201.4893  863.9704
#> 12: 216.00   222 227.00   231 234.00   240 250.00 1.0035756  751.4194  655.0188
#> 13: 150.00   157 160.00   164 168.00   173 181.00 1.0025186  927.9122  920.9413
#> 14: 117.00   122 125.00   128 131.00   135 143.00 1.0010009 1080.4014  964.2083
#> 15: 276.00   283 288.00   292 297.00   303 315.00 1.0002316 1159.2978  984.6276
#> 16: 268.00   280 286.00   292 299.00   306 320.00 1.0047058 1087.6045  957.9921
#> 17: 260.00   274 282.00   290 298.35   308 330.00 1.0002334 1129.6391  914.6275
#> 18: 250.00   269 280.00   291 301.00   316 344.00 0.9993186 1126.3831  903.3288
#> 19: 239.00   267 286.00   302 322.00   343 399.10 0.9992178 1328.2832  998.7573
#> 20: 233.95   292 327.00   363 397.00   447 565.05 0.9991666 1554.0485  999.3402
#>         q5   q20    q35   q50    q65   q80    q95      rhat  ess_bulk  ess_tail

# Nowcast posterior samples
summary(nowcast, type = "nowcast_samples")
#>        reference_date report_date .group max_confirm location age_group confirm
#>                <IDat>      <IDat>  <num>       <int>   <fctr>    <fctr>   <int>
#>     1:     2021-08-03  2021-08-22      1         149       DE       00+     149
#>     2:     2021-08-03  2021-08-22      1         149       DE       00+     149
#>     3:     2021-08-03  2021-08-22      1         149       DE       00+     149
#>     4:     2021-08-03  2021-08-22      1         149       DE       00+     149
#>     5:     2021-08-03  2021-08-22      1         149       DE       00+     149
#>    ---                                                                         
#> 19996:     2021-08-22  2021-08-22      1          45       DE       00+      45
#> 19997:     2021-08-22  2021-08-22      1          45       DE       00+      45
#> 19998:     2021-08-22  2021-08-22      1          45       DE       00+      45
#> 19999:     2021-08-22  2021-08-22      1          45       DE       00+      45
#> 20000:     2021-08-22  2021-08-22      1          45       DE       00+      45
#>        cum_prop_reported delay prop_reported .chain .iteration .draw sample
#>                    <num> <num>         <num>  <int>      <int> <int>  <num>
#>     1:                 1    19             0      1          1     1    149
#>     2:                 1    19             0      1          2     2    149
#>     3:                 1    19             0      1          3     3    149
#>     4:                 1    19             0      1          4     4    149
#>     5:                 1    19             0      1          5     5    149
#>    ---                                                                     
#> 19996:                 1     0             1      2        496   996    338
#> 19997:                 1     0             1      2        497   997    598
#> 19998:                 1     0             1      2        498   998    219
#> 19999:                 1     0             1      2        499   999    508
#> 20000:                 1     0             1      2        500  1000    297

# Nowcast model fit
summary(nowcast, type = "fit")
#>                    variable          mean        median          sd        mad
#>                      <char>         <num>         <num>       <num>      <num>
#>   1:                   lp__ -1373.3815400 -1372.7100000   7.4386468  7.1831970
#>   2: expr_lelatent_int[1,1]     4.1775366     4.1753300   0.1807851  0.1778527
#>   3:           expr_beta[1]     0.3568452     0.3851365   0.6071031  0.5922742
#>   4:           expr_beta[2]    -0.3387549    -0.3541355   0.5316359  0.5444528
#>   5:           expr_beta[3]    -0.8258812    -0.8167105   0.5264853  0.5388206
#>  ---                                                                          
#> 852:       pp_inf_obs[16,1]   293.0420000   292.0000000  15.7994892 14.8260000
#> 853:       pp_inf_obs[17,1]   291.4780000   290.0000000  21.1081280 19.2738000
#> 854:       pp_inf_obs[18,1]   293.1780000   291.0000000  29.4403983 28.1694000
#> 855:       pp_inf_obs[19,1]   308.5180000   302.0000000  51.1515215 46.7019000
#> 856:       pp_inf_obs[20,1]   375.6440000   363.0000000 103.4242807 91.1799000
#>                 q5           q20           q80           q95      rhat
#>              <num>         <num>         <num>         <num>     <num>
#>   1: -1386.3515000 -1379.3860000 -1367.2600000 -1.362146e+03 1.0165644
#>   2:     3.8798325     4.0294840     4.3297920  4.480233e+00 1.0003207
#>   3:    -0.6494806    -0.1630136     0.8722602  1.317674e+00 1.0001047
#>   4:    -1.2489460    -0.7875022     0.1375294  5.137213e-01 1.0029342
#>   5:    -1.6927830    -1.2671460    -0.3640068 -1.222673e-02 1.0007299
#>  ---                                                                  
#> 852:   268.0000000   280.0000000   306.0000000  3.200000e+02 1.0047058
#> 853:   260.0000000   274.0000000   308.0000000  3.300000e+02 1.0002334
#> 854:   250.0000000   269.0000000   316.0000000  3.440000e+02 0.9993186
#> 855:   239.0000000   267.0000000   343.0000000  3.991000e+02 0.9992178
#> 856:   233.9500000   292.0000000   447.0000000  5.650500e+02 0.9991666
#>       ess_bulk ess_tail
#>          <num>    <num>
#>   1:  202.8285 433.4364
#>   2:  990.9203 725.2305
#>   3:  867.1216 773.7010
#>   4: 1370.1095 692.4391
#>   5: 1019.0570 680.3411
#>  ---                   
#> 852: 1087.6045 957.9921
#> 853: 1129.6391 914.6275
#> 854: 1126.3831 903.3288
#> 855: 1328.2832 998.7573
#> 856: 1554.0485 999.3402

# Posterior predictions
summary(nowcast, type = "posterior_prediction")
#>      reference_date report_date .group max_confirm location age_group confirm
#>              <IDat>      <IDat>  <num>       <int>   <fctr>    <fctr>   <int>
#>   1:     2021-07-13  2021-07-13      1          59       DE       00+      21
#>   2:     2021-07-13  2021-07-14      1          59       DE       00+      33
#>   3:     2021-07-13  2021-07-15      1          59       DE       00+      36
#>   4:     2021-07-13  2021-07-16      1          59       DE       00+      40
#>   5:     2021-07-13  2021-07-17      1          59       DE       00+      43
#>  ---                                                                         
#> 626:     2021-08-20  2021-08-21      1         171       DE       00+     159
#> 627:     2021-08-20  2021-08-22      1         171       DE       00+     171
#> 628:     2021-08-21  2021-08-21      1         112       DE       00+      69
#> 629:     2021-08-21  2021-08-22      1         112       DE       00+     112
#> 630:     2021-08-22  2021-08-22      1          45       DE       00+      45
#>      cum_prop_reported delay new_confirm prop_reported   mean median        sd
#>                  <num> <num>       <int>         <num>  <num>  <num>     <num>
#>   1:         0.3559322     0          21    0.35593220 19.639     19  8.642649
#>   2:         0.5593220     1          12    0.20338983 20.812     19  9.566932
#>   3:         0.6101695     2           3    0.05084746  6.137      6  3.627311
#>   4:         0.6779661     3           4    0.06779661  4.147      4  2.595019
#>   5:         0.7288136     4           3    0.05084746  2.396      2  1.842438
#>  ---                                                                          
#> 626:         0.9298246     1          61    0.35672515 79.760     76 31.667100
#> 627:         1.0000000     2          12    0.07017544 12.362     11  6.193328
#> 628:         0.6160714     0          69    0.61607143 74.098     70 30.701090
#> 629:         1.0000000     1          43    0.38392857 47.543     43 22.022605
#> 630:         1.0000000     0          45    1.00000000 40.036     37 18.937617
#>          mad    q5   q20   q35   q50   q65   q80    q95      rhat  ess_bulk
#>        <num> <num> <num> <num> <num> <num> <num>  <num>     <num>     <num>
#>   1:  8.8956     7    12    15    19    22    27  35.00 0.9998578  950.1480
#>   2:  8.8956     8    13    16    19    23    28  38.00 0.9996637  806.5805
#>   3:  2.9652     1     3     4     6     7     9  13.00 1.0032698  967.3662
#>   4:  2.9652     1     2     3     4     5     6   9.00 0.9991688 1110.2815
#>   5:  1.4826     0     1     1     2     3     4   6.00 0.9996678  896.9374
#>  ---                                                                       
#> 626: 31.1346    36    53    65    76    87   104 137.05 1.0003079 1054.6289
#> 627:  5.9304     4     7     9    11    14    17  24.00 1.0025396  998.3479
#> 628: 29.6520    31    48    60    70    81    96 128.05 0.9988369 1194.4760
#> 629: 19.2738    20    30    37    43    52    62  91.00 1.0010545 1154.8141
#> 630: 17.7912    16    23    30    37    44    55  75.00 0.9993409 1159.6413
#>       ess_tail
#>          <num>
#>   1:  983.7776
#>   2:  667.5845
#>   3: 1001.0476
#>   4:  975.4648
#>   5:  922.8697
#>  ---          
#> 626:  881.3948
#> 627: 1035.5098
#> 628: 1028.2922
#> 629:  814.1646
#> 630:  855.4762