Skip to contents

[Maturing] Used to produce summary output either internally in regional_epinow or externally.

Usage

regional_summary(
  regional_output = NULL,
  reported_cases,
  results_dir = NULL,
  summary_dir = NULL,
  target_date = NULL,
  region_scale = "Region",
  all_regions = TRUE,
  return_output = FALSE,
  plot = TRUE,
  max_plot = 10,
  ...
)

Arguments

regional_output

A list of output as produced by regional_epinow() and stored in the regional list.

reported_cases

A <data.frame> of confirmed cases (confirm) by date (date), and region (region).

results_dir

An optional character string indicating the location of the results directory to extract results from.

summary_dir

A character string giving the directory in which to store summary of results.

target_date

A character string giving the target date for which to extract results (in the format "yyyy-mm-dd"). Defaults to latest available estimates.

region_scale

A character string indicating the name to give the regions being summarised.

all_regions

Logical, defaults to TRUE. Should summary plots for all regions be returned rather than just regions of interest.

return_output

Logical, defaults to FALSE. Should output be returned, this automatically updates to TRUE if no directory for saving is specified.

plot

Logical, defaults to TRUE. Should regional summary plots be produced.

max_plot

Numeric, defaults to 10. A multiplicative upper bound on the\ number of cases shown on the plot. Based on the maximum number of reported cases.

...

Additional arguments passed to report_plots.

Value

A list of summary measures and plots

See also

regional_epinow

Examples

# get example output from regional_epinow model
regional_out <- readRDS(system.file(
    package = "EpiNow2", "extdata", "example_regional_epinow.rds"
))

regional_summary(
  regional_output = regional_out$regional,
  reported_cases = regional_out$summary$reported_cases
)
#> INFO [2024-02-22 16:35:49] No summary directory specified so returning summary output
#> $latest_date
#> [1] "2020-04-21"
#> 
#> $results
#> $results$estimates
#> $results$estimates$summarised
#> Indices: <variable>, <region>
#>        region       date                 variable strat     type       median
#>        <char>     <Date>                   <char> <int>   <char>        <num>
#>   1: testland 2020-02-22                        R    NA estimate 2.220210e+00
#>   2: testland 2020-02-23                        R    NA estimate 2.195509e+00
#>   3: testland 2020-02-24                        R    NA estimate 2.160124e+00
#>   4: testland 2020-02-25                        R    NA estimate 2.110419e+00
#>   5: testland 2020-02-26                        R    NA estimate 2.071919e+00
#>  ---                                                                         
#> 710: realland 2020-04-25           reported_cases    NA forecast 2.352500e+03
#> 711: realland 2020-04-26           reported_cases    NA forecast 2.399500e+03
#> 712: realland 2020-04-27           reported_cases    NA forecast 2.230500e+03
#> 713: realland 2020-04-28           reported_cases    NA forecast 2.076500e+03
#> 714: realland       <NA> reporting_overdispersion    NA     <NA> 2.271327e-03
#>              mean           sd     lower_90     lower_50     lower_20
#>             <num>        <num>        <num>        <num>        <num>
#>   1: 2.219553e+00 1.445338e-01 1.996923e+00 2.133119e+00 2.177335e+00
#>   2: 2.186584e+00 1.221730e-01 1.990955e+00 2.110518e+00 2.156056e+00
#>   3: 2.151178e+00 1.028954e-01 1.977952e+00 2.082558e+00 2.122920e+00
#>   4: 2.113585e+00 8.673058e-02 1.962867e+00 2.054222e+00 2.088438e+00
#>   5: 2.074137e+00 7.390106e-02 1.954850e+00 2.016007e+00 2.057757e+00
#>  ---                                                                 
#> 710: 2.492760e+03 8.606040e+02 1.371900e+03 1.874000e+03 2.209600e+03
#> 711: 2.733715e+03 1.305219e+03 1.221650e+03 1.873250e+03 2.180200e+03
#> 712: 2.606245e+03 1.258184e+03 1.216450e+03 1.802000e+03 2.003600e+03
#> 713: 2.302320e+03 1.306279e+03 9.237500e+02 1.356000e+03 1.789200e+03
#> 714: 2.617061e-03 1.460935e-03 1.053273e-03 1.743021e-03 2.019149e-03
#>          upper_20     upper_50     upper_90
#>             <num>        <num>        <num>
#>   1: 2.264476e+00 2.325034e+00 2.443325e+00
#>   2: 2.221881e+00 2.274348e+00 2.367824e+00
#>   3: 2.180853e+00 2.221336e+00 2.302076e+00
#>   4: 2.146522e+00 2.170618e+00 2.250150e+00
#>   5: 2.095375e+00 2.129747e+00 2.198137e+00
#>  ---                                       
#> 710: 2.589000e+03 2.962250e+03 3.947050e+03
#> 711: 2.705200e+03 3.282250e+03 5.246400e+03
#> 712: 2.669800e+03 3.108000e+03 4.863100e+03
#> 713: 2.337000e+03 2.897250e+03 4.839550e+03
#> 714: 2.569773e-03 3.112898e-03 5.067890e-03
#> 
#> 
#> 
#> $summarised_results
#> $summarised_results$table
#>      Region New confirmed cases by infection date
#>      <char>                                <char>
#> 1: realland                   2152 (1027 -- 4614)
#> 2: testland                   2264 (1067 -- 4638)
#>    Expected change in daily cases Effective reproduction no.
#>                            <fctr>                     <char>
#> 1:              Likely decreasing         0.87 (0.55 -- 1.2)
#> 2:              Likely decreasing          0.89 (0.6 -- 1.2)
#>            Rate of growth Doubling/halving time (days)
#>                    <char>                       <char>
#> 1: -0.03 (-0.12 -- 0.042)             -23 (16 -- -5.9)
#> 2: -0.024 (-0.1 -- 0.045)             -29 (16 -- -6.9)
#> 
#> $summarised_results$data
#>      region            estimate  median    mean     sd lower_90 lower_50
#>      <fctr>              <char>   <num>   <num>  <num>    <num>    <num>
#> 1: testland 2264 (1067 -- 4638) 2264.00 2521.00 1283.0  1067.00  1663.00
#> 2: realland 2152 (1027 -- 4614) 2152.00 2427.00 1136.0  1027.00  1778.00
#> 3: testland   0.89 (0.6 -- 1.2)    0.89    0.90    0.2     0.60     0.77
#> 4: realland  0.87 (0.55 -- 1.2)    0.87    0.88    0.2     0.55     0.76
#>    lower_20 upper_20 upper_50 upper_90                                metric
#>       <num>    <num>    <num>    <num>                                <fctr>
#> 1:  2086.00  2479.00  3039.00   4638.0 New confirmed cases by infection date
#> 2:  2000.00  2417.00  2918.00   4614.0 New confirmed cases by infection date
#> 3:     0.84     0.93     1.00      1.2            Effective reproduction no.
#> 4:     0.84     0.91     0.97      1.2            Effective reproduction no.
#>    Expected change in daily cases prob_control
#>                            <fctr>       <list>
#> 1:              Likely decreasing         0.74
#> 2:              Likely decreasing         0.78
#> 3:              Likely decreasing         0.74
#> 4:              Likely decreasing         0.78
#> 
#> $summarised_results$regions_by_inc
#> [1] "testland" "realland"
#> 
#> 
#> $summary_plot

#> 
#> $summarised_measures
#> $summarised_measures$rt
#>        region       date strat     type    median      mean         sd
#>        <char>     <Date> <int>   <char>     <num>     <num>      <num>
#>   1: realland 2020-02-22    NA estimate 2.2003528 2.2088615 0.15228717
#>   2: realland 2020-02-23    NA estimate 2.1811604 2.1821292 0.12557945
#>   3: realland 2020-02-24    NA estimate 2.1536436 2.1521783 0.10406800
#>   4: realland 2020-02-25    NA estimate 2.1184680 2.1190760 0.08739863
#>   5: realland 2020-02-26    NA estimate 2.0821297 2.0830099 0.07488504
#>  ---                                                                  
#> 130: testland 2020-04-24    NA forecast 0.8935489 0.8985073 0.20101719
#> 131: testland 2020-04-25    NA forecast 0.8935489 0.8985073 0.20101719
#> 132: testland 2020-04-26    NA forecast 0.8935489 0.8985073 0.20101719
#> 133: testland 2020-04-27    NA forecast 0.8935489 0.8985073 0.20101719
#> 134: testland 2020-04-28    NA forecast 0.8935489 0.8985073 0.20101719
#>       lower_90  lower_50  lower_20  upper_20 upper_50 upper_90
#>          <num>     <num>     <num>     <num>    <num>    <num>
#>   1: 1.9649006 2.1025353 2.1642174 2.2388770 2.299879 2.478612
#>   2: 1.9840253 2.1030211 2.1442151 2.2073732 2.259479 2.399317
#>   3: 1.9838802 2.0816106 2.1274818 2.1738586 2.217655 2.329371
#>   4: 1.9902555 2.0601806 2.0987592 2.1375215 2.178608 2.252799
#>   5: 1.9690406 2.0292978 2.0652307 2.1020075 2.138237 2.206885
#>  ---                                                          
#> 130: 0.5988557 0.7718084 0.8447838 0.9283598 1.023374 1.222829
#> 131: 0.5988557 0.7718084 0.8447838 0.9283598 1.023374 1.222829
#> 132: 0.5988557 0.7718084 0.8447838 0.9283598 1.023374 1.222829
#> 133: 0.5988557 0.7718084 0.8447838 0.9283598 1.023374 1.222829
#> 134: 0.5988557 0.7718084 0.8447838 0.9283598 1.023374 1.222829
#> 
#> $summarised_measures$growth_rate
#>        region       date strat     type      median        mean          sd
#>        <char>     <Date> <int>   <char>       <num>       <num>       <num>
#>   1: realland 2020-02-22    NA estimate  0.19361000  0.19425184 0.019254246
#>   2: realland 2020-02-23    NA estimate  0.19116490  0.19098521 0.015999894
#>   3: realland 2020-02-24    NA estimate  0.18763428  0.18723168 0.013399641
#>   4: realland 2020-02-25    NA estimate  0.18307705  0.18300111 0.011390845
#>   5: realland 2020-02-26    NA estimate  0.17831621  0.17831471 0.009884407
#>  ---                                                                       
#> 130: testland 2020-04-24    NA forecast -0.02367809 -0.02596132 0.046356583
#> 131: testland 2020-04-25    NA forecast -0.02367809 -0.02596132 0.046356583
#> 132: testland 2020-04-26    NA forecast -0.02367809 -0.02596132 0.046356583
#> 133: testland 2020-04-27    NA forecast -0.02367809 -0.02596132 0.046356583
#> 134: testland 2020-04-28    NA forecast -0.02367809 -0.02596132 0.046356583
#>        lower_90    lower_50    lower_20   upper_20    upper_50   upper_90
#>           <num>       <num>       <num>      <num>       <num>      <num>
#>   1:  0.1625707  0.18099633  0.18899447  0.1984755 0.206067649 0.22756992
#>   2:  0.1651814  0.18105989  0.18641764  0.1945008 0.201054822 0.21816182
#>   3:  0.1651616  0.17824781  0.18424960  0.1902309 0.195802083 0.20969020
#>   4:  0.1660278  0.17541379  0.18050172  0.1855517 0.190838603 0.20022011
#>   5:  0.1631374  0.17129504  0.17608340  0.1809273 0.185644377 0.19443892
#>  ---                                                                     
#> 130: -0.1009619 -0.05317774 -0.03515351 -0.0157384 0.004972587 0.04461742
#> 131: -0.1009619 -0.05317774 -0.03515351 -0.0157384 0.004972587 0.04461742
#> 132: -0.1009619 -0.05317774 -0.03515351 -0.0157384 0.004972587 0.04461742
#> 133: -0.1009619 -0.05317774 -0.03515351 -0.0157384 0.004972587 0.04461742
#> 134: -0.1009619 -0.05317774 -0.03515351 -0.0157384 0.004972587 0.04461742
#> 
#> $summarised_measures$cases_by_infection
#>        region       date strat     type median   mean     sd lower_90 lower_50
#>        <char>     <Date> <int>   <char>  <num>  <num>  <num>    <num>    <num>
#>   1: realland 2020-02-22    NA estimate  156.7  156.5   11.9    136.6    148.8
#>   2: realland 2020-02-23    NA estimate  198.4  198.7   14.5    174.9    188.6
#>   3: realland 2020-02-24    NA estimate  254.8  254.0   18.2    226.8    241.2
#>   4: realland 2020-02-25    NA estimate  322.8  323.5   23.3    286.7    305.7
#>   5: realland 2020-02-26    NA estimate  407.0  409.5   29.9    367.1    387.1
#>  ---                                                                          
#> 130: testland 2020-04-24    NA forecast 2047.1 2524.5 1875.8    749.1   1371.4
#> 131: testland 2020-04-25    NA forecast 1987.5 2544.4 2122.0    664.1   1292.6
#> 132: testland 2020-04-26    NA forecast 1947.6 2574.1 2400.3    588.4   1218.2
#> 133: testland 2020-04-27    NA forecast 1898.0 2614.3 2716.6    521.1   1148.2
#> 134: testland 2020-04-28    NA forecast 1841.6 2665.5 3078.0    461.2   1082.1
#>      lower_20 upper_20 upper_50 upper_90
#>         <num>    <num>    <num>    <num>
#>   1:    153.7    159.5    164.4    175.5
#>   2:    196.0    203.5    208.4    221.0
#>   3:    249.3    257.8    267.5    284.4
#>   4:    318.4    328.1    339.3    362.6
#>   5:    400.6    415.8    432.4    461.0
#>  ---                                    
#> 130:   1822.4   2339.1   3109.3   5532.0
#> 131:   1729.1   2298.9   3115.8   5834.9
#> 132:   1640.2   2238.6   3111.3   6164.9
#> 133:   1558.9   2185.9   3153.6   6532.0
#> 134:   1507.2   2148.0   3201.4   6921.5
#> 
#> $summarised_measures$cases_by_report
#>        region       date strat     type median   mean     sd lower_90 lower_50
#>        <char>     <Date> <int>   <char>  <num>  <num>  <num>    <num>    <num>
#>   1: realland 2020-02-22    NA estimate   66.0   68.7   21.3     38.0     54.0
#>   2: realland 2020-02-23    NA estimate   77.0   79.2   23.0     45.9     62.0
#>   3: realland 2020-02-24    NA estimate   77.0   80.5   23.6     49.0     64.0
#>   4: realland 2020-02-25    NA estimate   70.0   73.5   22.1     42.0     59.0
#>   5: realland 2020-02-26    NA estimate   75.0   78.3   22.7     47.9     59.0
#>  ---                                                                          
#> 130: testland 2020-04-24    NA forecast 2955.5 3088.6 1087.9   1680.9   2319.0
#> 131: testland 2020-04-25    NA forecast 2416.5 2547.2  953.7   1310.0   1867.5
#> 132: testland 2020-04-26    NA forecast 2490.0 2750.1 1214.5   1254.8   1866.2
#> 133: testland 2020-04-27    NA forecast 2401.5 2769.8 1459.5   1104.8   1794.5
#> 134: testland 2020-04-28    NA forecast 2022.0 2339.9 1363.1    869.5   1428.5
#>      lower_20 upper_20 upper_50 upper_90
#>         <num>    <num>    <num>    <num>
#>   1:     61.6     71.0     78.0    115.0
#>   2:     72.0     82.4     92.2    119.0
#>   3:     71.0     83.0     93.0    127.0
#>   4:     67.0     75.0     85.2    116.1
#>   5:     70.0     83.0     91.0    122.0
#>  ---                                    
#> 130:   2569.0   3133.4   3802.5   4789.3
#> 131:   2244.4   2699.0   3059.2   4175.0
#> 132:   2292.2   2731.8   3400.5   4946.0
#> 133:   2089.6   2806.8   3329.0   5118.3
#> 134:   1746.8   2275.4   2786.8   4650.1
#> 
#> 
#> $reported_cases
#> Index: <region>
#>            date confirm   region
#>          <Date>   <num>   <char>
#>   1: 2020-02-22      14 testland
#>   2: 2020-02-23      62 testland
#>   3: 2020-02-24      53 testland
#>   4: 2020-02-25      97 testland
#>   5: 2020-02-26      93 testland
#>  ---                            
#> 116: 2020-04-17    3786 realland
#> 117: 2020-04-18    3493 realland
#> 118: 2020-04-19    3491 realland
#> 119: 2020-04-20    3047 realland
#> 120: 2020-04-21    2256 realland
#> 
#> $high_plots
#> $high_plots$infections

#> 
#> $high_plots$reports

#> 
#> $high_plots$R

#> 
#> $high_plots$growth_rate

#> 
#> 
#> $plots
#> $plots$infections

#> 
#> $plots$reports

#> 
#> $plots$R

#> 
#> $plots$growth_rate

#> 
#>