Title: | Swash-Backwash Model for the Single Epidemic Wave |
---|---|
Description: | The Swash-Backwash Model for the Single Epidemic Wave was developed by Cliff and Haggett (2006) <doi:10.1007/s10109-006-0027-8> to model the velocity of spread of infectious diseases across space. This package enables the calculation of the Swash-Backwash Model for user-supplied panel data on regional infections. The package also provides additional functions for bootstrap confidence intervals, country comparison, visualization of results, and data management. |
Authors: | Thomas Wieland [aut, cre]
|
Maintainer: | Thomas Wieland <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.0 |
Built: | 2025-02-24 21:20:23 UTC |
Source: | CRAN |
Swash-Backwash Model for the single epidemic wave (Cliff and Haggett 2006) with additional functions for bootstrap confidence intervals and data management
The Swash-Backwash Model for the Single Epidemic Wave is the spatial equivalent of the classic epidemiological SIR (Susceptible-Infected-Recovered) model. It was developed by Cliff and Haggett (2006) to model the velocity of spread of infectious diseases across space. Current applications can be found, for example, in Smallman-Raynor et al. (2022a,b). This package enables the calculation of the Swash-Backwash Model for user-supplied panel data on regional infections. The core of this is the swash()
function, which calculates the model and creates a model object of the sbm
class defined in this package. This class can be used to visualize results (summary()
, plot()
) and calculate bootstrap confidence intervals for the model estimates (confint(sbm)
). The package also contains additional helper functions.
Thomas Wieland
Swash-Backwash Model:
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022a) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022b) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
Basics of epidemiological modeling:
Li, MY (2018) An Introduction to Mathematical Modeling of Infectious Diseases. doi:10.1007/978-3-319-72122-4
Nishiura H, Chowell G (2009) The effective reproduction number as a prelude to statistical estimation of time-dependent epidemic trends. In Chowell G, Hyman JM, Bettencourt LMA (eds.) Mathematical and statistical estimation approaches in epidemiology, 103–121. doi:10.1007/978-90-481-2313-1_5
Spatio-temporal analysis and modeling of infectious diseases:
Bourdin S, Jeanne L, Nadou F, Noiret G (2021) Does lockdown work? A spatial analysis of the spread and concentration of Covid-19 in Italy. Regional Studies, 55, 1182–1193. doi:10.1080/00343404.2021.1887471
Chowell G, Viboud C, Hyman JM, Simonsen L (2015) The Western Africa ebola virus disease epidemic exhibits both global exponential and local polynomial growth rates. PLOS Currents Outbreaks, ecurrents.outbreaks.8b55f4bad99ac5c5db3663e916803261. doi:10.1371/currents.outbreaks.8b55f4bad99ac5c5db3663e916803261
Viboud C, Bjørnstad ON, Smith DL, Simonsen L, Miller MA, Grenfell BT (2006) Synchrony, Waves, and Spatial Hierarchies in the Spread of Influenza. Science 312,447-451. doi:10.1126/science.1125237
Wieland T (2020) Flatten the Curve! Modeling SARS-CoV-2/COVID-19 Growth in Germany at the County Level. REGION 7(2), 43–83. doi:10.18335/region.v7i2.324
Panel data:
Greene, WH (2012) Econometric Analysis. Ch. 11.
Wooldridge, JM (2012) Introductory Econometrics. A Modern Approach. Ch. 13.
Bootstrapping und bootstrap confidence intervals:
Efron B, Tibshirani RJ (1993) An Introduction to the Bootstrap.
Ramachandran KM, Tsokos CP (2021) Mathematical Statistics with Applications in R (Third Edition). Ch. 13.3.1 (Bootstrap confidence intervals). doi:10.1016/B978-0-12-817815-7.00013-0
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) summary(CH_covidwave1) # Summary of Swash-Backwash Model plot(CH_covidwave1) # Plot of Swash-Backwash Model edges and total epidemic curve
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) summary(CH_covidwave1) # Summary of Swash-Backwash Model plot(CH_covidwave1) # Plot of Swash-Backwash Model edges and total epidemic curve
This function corrects non-balanced input panel data by replacing missing entries with a user-given constant (e.g., 0).
as_balanced( data, col_cases, col_date, col_region, fill_missing = 0 )
as_balanced( data, col_cases, col_date, col_region, fill_missing = 0 )
data |
|
col_cases |
Column containing the cases (numeric) |
col_date |
Column containing the time points (e.g., days) |
col_region |
Column containing the unique identifier of the regions (e.g., name, NUTS 3 code) |
fill_missing |
Constant to fill missing values (default and recommended: 0) |
The Swash-Backwash Model for the Single Epidemic Wave does not necessarily require balanced panel data in order for the calculations to be carried out. However, for a correct estimation it is implicitly assumed that the input data is balanced. The function corrects non-balanced panel data. It is executed automatically whithin the swash()
function (when using the function is_balanced()
), but can also be used separately.
data |
Corrected input dataset ( |
Thomas Wieland
Swash-Backwash Model:
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
Panel data:
Greene, WH (2012) Econometric Analysis. Ch. 11.
Wooldridge, JM (2012) Introductory Econometrics. A Modern Approach. Ch. 13.
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave COVID19Cases_geoRegion_balanced <- is_balanced( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Test whether "COVID19Cases_geoRegion" is balanced panel data COVID19Cases_geoRegion_balanced$data_balanced # Balanced? TRUE or FALSE if (COVID19Cases_geoRegion_balanced$data_balanced == FALSE) { COVID19Cases_geoRegion <- as_balanced( COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) } # Correction of dataset "COVID19Cases_geoRegion" # not necessary as parameter balance of is_balanced is set TRUE by default
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave COVID19Cases_geoRegion_balanced <- is_balanced( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Test whether "COVID19Cases_geoRegion" is balanced panel data COVID19Cases_geoRegion_balanced$data_balanced # Balanced? TRUE or FALSE if (COVID19Cases_geoRegion_balanced$data_balanced == FALSE) { COVID19Cases_geoRegion <- as_balanced( COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) } # Correction of dataset "COVID19Cases_geoRegion" # not necessary as parameter balance of is_balanced is set TRUE by default
This function enables bootstrap estimates for the mean difference of Swash-Backwash Model parameters of two countries to be compared.
compare_countries( sbm1, sbm2, country_names = c("Country 1", "Country 2"), indicator = "R_0A", iterations = 100, samples_ratio = 0.8, alpha = 0.05, replace = TRUE )
compare_countries( sbm1, sbm2, country_names = c("Country 1", "Country 2"), indicator = "R_0A", iterations = 100, samples_ratio = 0.8, alpha = 0.05, replace = TRUE )
sbm1 |
A |
sbm2 |
A |
country_names |
|
indicator |
|
iterations |
Number of iterations for resampling (default: 100) |
samples_ratio |
Proportion of regions included in each sample (default: 0.8) |
alpha |
Significance level |
replace |
Resampling with replacement ( |
The combination of the Swash-Backwash Model and bootstrap resampling allows the estimation of mean differences of a user-specified model parameter (e.g., spatial reproduction number ) between two countries. This makes it possible to check whether the spatial spread velocity of a communicable disease is significantly different in one country than in another country. Since the initial data in the Swash-Backwash Model should be balanced, entity-based bootstrap sampling is carried out in the
compare_countries()
function. This means that not, for example, 80% of all observations are included in each sample at a sample ratio equal to = 0.8, but rather all observations for 80% of the regions. For both countries,
bootstrap samples (default: 100) are drawn for which the Swash-Backwash Model is calculated. Based on the distribution of indicators, confidence intervals are calculated at the user-specified significance level
. The
compare_countries()
function calculates the differences of the user's desired indicator between the two samples, , and also calculates
confidence intervals for this.
object of class countries
, see countries-class
Thomas Wieland
Swash-Backwash Model:
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
Bootstrapping und bootstrap confidence intervals:
Efron B, Tibshirani RJ (1993) An Introduction to the Bootstrap.
Ramachandran KM, Tsokos CP (2021) Mathematical Statistics with Applications in R (Third Edition). Ch. 13.3.1 (Bootstrap confidence intervals). doi:10.1016/B978-0-12-817815-7.00013-0
data(COVID19Cases_geoRegion) # Get Swiss COVID19 cases at NUTS 3 level data(Oesterreich_Faelle) # Get Austrian COVID19 cases at NUTS 3 level # (first wave, same final date as in Swiss data: 2020-05-31) COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) AT_covidwave1 <- swash ( data = Oesterreich_Faelle, col_cases = "Faelle", col_date = "Datum", col_region = "NUTS3" ) # Swash-Backwash Model for Austrian COVID19 cases # Spatial aggregate: NUTS 3 AT_vs_CH <- compare_countries( CH_covidwave1, AT_covidwave1, country_names = c("Switzerland", "Austria")) # Country comparison Switzerland vs. Austria # default config: 100 iterations, alpha = 0.05, sample ratio = 80%, # indicator: R_0A summary(AT_vs_CH) # Summary of country comparison plot(AT_vs_CH) # Plot of country comparison
data(COVID19Cases_geoRegion) # Get Swiss COVID19 cases at NUTS 3 level data(Oesterreich_Faelle) # Get Austrian COVID19 cases at NUTS 3 level # (first wave, same final date as in Swiss data: 2020-05-31) COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) AT_covidwave1 <- swash ( data = Oesterreich_Faelle, col_cases = "Faelle", col_date = "Datum", col_region = "NUTS3" ) # Swash-Backwash Model for Austrian COVID19 cases # Spatial aggregate: NUTS 3 AT_vs_CH <- compare_countries( CH_covidwave1, AT_covidwave1, country_names = c("Switzerland", "Austria")) # Country comparison Switzerland vs. Austria # default config: 100 iterations, alpha = 0.05, sample ratio = 80%, # indicator: R_0A summary(AT_vs_CH) # Summary of country comparison plot(AT_vs_CH) # Plot of country comparison
confint
Methods for function confint
signature(object = "sbm", iterations = 100, samples_ratio = 0.8, alpha = 0.05, replace = TRUE)
Creates bootstrap confidence intervals for sbm
objects. The argument iterations
indicates the number of bootstrap samples which are drawn. Since the initial data in the Swash-Backwash Model should be balanced, entity-based bootstrap sampling is carried out. This means that not, for example, 80% of all observations are included in each sample at a sample ratio equal to = 0.8 (
samples_ratio = 0.8
), but rather all observations for 80% of the regions. The significance level for the confidence intervals is set by the argument
alpha
(default: 0.05, which corresponds to a 95% confidence level).
Thomas Wieland
Swash-Backwash Model:
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
Bootstrapping und bootstrap confidence intervals:
Efron B, Tibshirani RJ (1993) An Introduction to the Bootstrap.
Ramachandran KM, Tsokos CP (2021) Mathematical Statistics with Applications in R (Third Edition). Ch. 13.3.1 (Bootstrap confidence intervals). doi:10.1016/B978-0-12-817815-7.00013-0
"countries"
The class "countries"
contains the results of a two-country comparison analysis using the Swash-Backwash Model, including two "sbm_ci"
classes for each country. Use summary(countries)
and plot(countries)
for results summary and plotting, respectively.
Objects can be created by calls of the form new("countries", ...)
.
Objects can be created by the function compare_countries(sbm1, sbm2)
.
sbm_ci1
:Object of class "sbm_ci"
Results of "confint(sbm1)"
for country 1
sbm_ci2
:Object of class "sbm_ci"
Results of "confint(sbm1)"
for country 2
D
:Object of class "numeric"
Results: Difference between the samples with respect to the chosen indicator
D_ci
:Object of class "numeric"
Results: confidence intervals of
config
:Object of class "list"
Configuration details for bootstrap sampling
country_names
:Object of class "character"
User-stated country names
indicator
:Object of class "character"
User-stated indicator to be tested
signature(x = "countries")
: Plots the results of a two-country comparison with the Swash-Backwash Model
signature(object = "countries")
: Prints an countries
object; use summary(sbm_ci)
for results
signature(object = "countries")
: Prints a summary of a countries
object (results of the two-country comparison)
Thomas Wieland
showClass("countries")
showClass("countries")
A dataset containing COVID-19 cases by region (NUTS 3 = cantons) and time periods (days) for Switzerland (Source: Federal Office of Public Health FOPH).
data(COVID19Cases_geoRegion)
data(COVID19Cases_geoRegion)
A data.frame with multiple columns:
(character) Region for which the data was collected.
(Date) Date of record.
(integer) Number of reported cases on this date.
(integer) Cumulative case numbers.
(logical) Indicates whether the time period covers the last 14 days.
(logical) Indicates whether the time period covers all previous data.
(integer) Offset of the last 7 days.
(integer) Cumulative case numbers of the last 7 days.
(integer) Offset of the last 14 days.
(integer) Cumulative case numbers of the last 14 days.
(integer) Offset of the last 28 days.
(integer) Cumulative case numbers of the last 28 days.
(numeric) Sum of the last 7 days.
(numeric) Sum of the last 14 days.
(numeric) Average of the last 7 days.
(numeric) Average of the last 14 days.
(integer) Difference from the last age group.
(integer) Population of the region.
(numeric) Incidence of the entries.
(numeric) Incidence of cumulative cases.
(numeric) Incidence of the 7-day average.
(numeric) Incidence of the 14-day average.
(numeric) Incidence of cumulative cases in the last 7 days.
(numeric) Incidence of cumulative cases in the last 14 days.
(numeric) Incidence of cumulative cases in the last 28 days.
(numeric) Incidence of the last 7 days.
(numeric) Incidence of the last 14 days.
(numeric) Difference in sums of the last 7 days.
(numeric) Difference in incidence of the last 7 days.
(character) Type of recorded data (e.g., COVID-19 cases).
(character) Variant of the data type.
(character) Version of the data collection.
(character) Unit of date specification (e.g., day).
(integer) Last known count of entries.
(integer) Newly reported entries.
(integer) Difference in last entries.
The data is included as it was published in ??. Note that the reporting date equals the date of SARS-CoV-2 testing.
Federal Office of Public Health FOPH (2023) COVID-19 Dashboard Source Data. https://www.covid19.admin.ch/api/data/documentation (retrieved 2023-06-28)
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave COVID19Cases_geoRegion_balanced <- is_balanced( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Test whether "COVID19Cases_geoRegion" is balanced panel data COVID19Cases_geoRegion_balanced$data_balanced # Balanced? TRUE or FALSE
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave COVID19Cases_geoRegion_balanced <- is_balanced( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Test whether "COVID19Cases_geoRegion" is balanced panel data COVID19Cases_geoRegion_balanced$data_balanced # Balanced? TRUE or FALSE
Plot of a histogram of a given vector x
and the related confidence intervals (lower
, upper
).
hist_ci( x, alpha = 0.05, col_bars = "grey", col_ci = "red", ... )
hist_ci( x, alpha = 0.05, col_bars = "grey", col_ci = "red", ... )
x |
A numeric vector |
alpha |
Significance level |
col_bars |
Color of bars in histogram |
col_ci |
Color of lines for confidence interval |
... |
Additional arguments passed to |
Helper function for plot(sbm_ci)
, but may be used separately.
Histogram plot, no returned value
Thomas Wieland
numeric_vector <- c(1,9,5,6,3,10,20,6,9,14,3,5,8,6,11) # any numeric vector hist_ci(numeric_vector)
numeric_vector <- c(1,9,5,6,3,10,20,6,9,14,3,5,8,6,11) # any numeric vector hist_ci(numeric_vector)
The function tests whether the input panel data with regional infections is balanced.
is_balanced( data, col_cases, col_date, col_region, as_balanced = TRUE, fill_missing = 0 )
is_balanced( data, col_cases, col_date, col_region, as_balanced = TRUE, fill_missing = 0 )
data |
|
col_cases |
Column containing the cases (numeric) |
col_date |
Column containing the time points (e.g., days) |
col_region |
Column containing the unique identifier of the regions (e.g., name, NUTS 3 code) |
as_balanced |
Boolean argument which indicates whether non-balanced panel data shall be balanced (default: TRUE) |
fill_missing |
Constant to fill missing values (default and recommended: 0) |
The Swash-Backwash Model for the Single Epidemic Wave does not necessarily require balanced panel data in order for the calculations to be carried out. However, for a correct estimation it is implicitly assumed that the input data is balanced. The function tests whether the panel data is balanced. It is executed automatically whithin the swash()
function (using automatic correction with as_balanced = TRUE
), but can also be used separately.
List with two entries:
data_balanced |
Result of test ( |
data |
Input dataset ( |
Thomas Wieland
Swash-Backwash Model:
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
Panel data:
Greene, WH (2012) Econometric Analysis. Ch. 11.
Wooldridge, JM (2012) Introductory Econometrics. A Modern Approach. Ch. 13.
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave COVID19Cases_geoRegion_balanced <- is_balanced( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Test whether "COVID19Cases_geoRegion" is balanced panel data COVID19Cases_geoRegion_balanced$data_balanced # Balanced? TRUE or FALSE if (COVID19Cases_geoRegion_balanced$data_balanced == FALSE) { COVID19Cases_geoRegion <- as_balanced( COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) } # Correction of dataset "COVID19Cases_geoRegion" # not necessary as parameter balance of is_balanced is set TRUE by default
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave COVID19Cases_geoRegion_balanced <- is_balanced( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Test whether "COVID19Cases_geoRegion" is balanced panel data COVID19Cases_geoRegion_balanced$data_balanced # Balanced? TRUE or FALSE if (COVID19Cases_geoRegion_balanced$data_balanced == FALSE) { COVID19Cases_geoRegion <- as_balanced( COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) } # Correction of dataset "COVID19Cases_geoRegion" # not necessary as parameter balance of is_balanced is set TRUE by default
A dataset containing COVID-19 cases by region (NUTS 3) and time periods (days) for Austria (Source: BMSGPK).
data(Oesterreich_Faelle)
data(Oesterreich_Faelle)
A data.frame with multiple columns:
(character) Region for which the data was collected.
(Date) Date of record.
(integer) Number of reported cases on this date.
The original data was originally published by BMSGPK at a smaller spatial scale level (political districts, "Politische Bezirke"). The data was linked to a corresponding shapefile from Statistik Austria (2022), joined to the NUTS3 level via a spatial join, and summed over the Austrian NUTS3 regions. The spatial join is based on polygon centroids of the political districts level; in cases where the centroid was outside the polygon, it was placed inside the polygon manually.
BMSGPK, Oesterreichisches COVID-19 Open Data Informationsportal (2022) COVID-19: Zeitliche Darstellung von Daten zu Covid19-Faellen je Bezirk. https://www.data.gv.at/katalog/dataset/4b71eb3d-7d55-4967-b80d-91a3f220b60c (retrieved 2022-06-23)
Statistik Austria (2022) Politische Bezirke. https://www.data.gv.at/katalog/dataset/stat_gliederung-osterreichs-in-politische-bezirke131e2 (retrieved 2022-06-27)
Wieland T (2022) C19dNUTS: Dataset of Regional COVID-19 Deaths per 100,000 Pop (NUTS). R package v1.0.1. doi:10.32614/CRAN.package.C19dNUTS
data(Oesterreich_Faelle) # Get Austrian COVID19 cases at NUTS 3 level # (first wave, same final date as in Swiss data: 2020-05-31) AT_covidwave1 <- swash ( data = Oesterreich_Faelle, col_cases = "Faelle", col_date = "Datum", col_region = "NUTS3" ) # Swash-Backwash Model for Austrian COVID19 cases # Spatial aggregate: NUTS 3 summary(AT_covidwave1) # Summary of model results
data(Oesterreich_Faelle) # Get Austrian COVID19 cases at NUTS 3 level # (first wave, same final date as in Swiss data: 2020-05-31) AT_covidwave1 <- swash ( data = Oesterreich_Faelle, col_cases = "Faelle", col_date = "Datum", col_region = "NUTS3" ) # Swash-Backwash Model for Austrian COVID19 cases # Spatial aggregate: NUTS 3 summary(AT_covidwave1) # Summary of model results
Plots regional infection curves in plots for
regions.
plot_regions( object, col = "red", scale = FALSE, normalize_by_col = NULL, normalize_factor = 1 )
plot_regions( object, col = "red", scale = FALSE, normalize_by_col = NULL, normalize_factor = 1 )
object |
object of class |
col |
Color of line plot |
scale |
Set y axis of the plots uniformly based on the maximum value across all regions? (boolean, default: |
normalize_by_col |
Normalize infection numbers by stating a column in the input data frame (e.g., regional population) |
normalize_factor |
Multiply density/incidence with a factor (say, 100,000 inhabitants) |
Plots regional infection curves in plots for
regions, with the number of columns equals 4 and the number of rows is calculated based the size of
.
Plot, only no returned value
Thomas Wieland
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) plot_regions(CH_covidwave1) # Plot of regional infections
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) plot_regions(CH_covidwave1) # Plot of regional infections
plot_regions
Methods for function plot_regions
signature(object = "sbm", col = "red", scale = FALSE, normalize_by_col = NULL, normalize_factor = 1)
Plots regional infection curves in plots for
regions, with the number of columns equals 4 and the number of rows is calculated based the size of
. Set the color by the argument
col
. If scale
is TRUE
, the y axis of the plots is set uniformly based on the maximum value across all regions. If the input data contains a column to normalize the infection numbers (such as regional population), the user may use this data to normalize the infection numbers by setting normalize_by_col
. If this density value should be multiplied by a factor (e.g. regional infections per 100,000 inhabitants), this can be set with the argument normalize_by_col
(default: 1).
Thomas Wieland
plot
Methods for function plot
signature(x = "sbm")
Plots the results of the Swash-Backwash Model; two plots: edges over time, total infections per time unit
signature(x = "sbm_ci")
Plots the results of bootstrap confidence intervals for the Swash-Backwash Model; one figure with six plots: ,
,
,
,
, and
Thomas Wieland
print
Methods for function print
signature(x = "sbm")
Prints an sbm
object; use summary(sbm)
for results
signature(x = "sbm_ci")
Prints an sbm_ci
object; use summary(sbm_ci)
for results
Computes quantiles for a given vector x
and the related confidence intervals (lower
, upper
).
quantile_ci( x, alpha = 0.05 )
quantile_ci( x, alpha = 0.05 )
x |
A numeric vector |
alpha |
Significance level |
Helper function for plot(sbm_ci)
, but may be used separately.
A numeric vector with lower and upper quantile
Thomas Wieland
numeric_vector <- c(1,9,5,6,3,10,20,6,9,14,3,5,8,6,11) # any numeric vector quantile_ci(numeric_vector)
numeric_vector <- c(1,9,5,6,3,10,20,6,9,14,3,5,8,6,11) # any numeric vector quantile_ci(numeric_vector)
"sbm_ci"
The class "sbm_ci"
contains the results of the Swash-Backwash Model, confidence intervals for the model estimates, and the related input data as well as additional information. Use summary(sbm_ci)
and plot(sbm_ci)
for results summary and plotting, respectively.
Objects can be created by the function confint(sbm)
.
R_0A
:Object of class "numeric"
Model result: spatial reproduction number
integrals
:Object of class "numeric"
Model result: integrals ,
, and
velocity
:Object of class "numeric"
Model result: velocity measures and
occ_regions
:Object of class "data.frame"
Model result: Occurence at regional level
cases_by_date
:Object of class "data.frame"
Total cases by date
cases_by_region
:Object of class "data.frame"
Cumulative cases by region
input_data
:Object of class "data.frame"
Input data
data_statistics
:Object of class "numeric"
Diagnostics of input data
col_names
:Object of class "character"
Column names in input data
integrals_ci
:Object of class "list"
Confidence intervals for integrals ,
, and
velocity_ci
:Object of class "list"
Confidence intervals for velocity measures and
R_0A_ci
:Object of class "numeric"
Confidence intervals for spatial reproduction number
iterations
:Object of class "data.frame"
Results of bootstrap sampling iterations
ci
:Object of class "numeric"
Lower and upper confidence intervals based on user input
config
:Object of class "list"
Configuration details for bootstrap sampling
signature(x = "sbm_ci")
: Plots the results of bootstrap confidence intervals for the Swash-Backwash Model; one figure with six plots: ,
,
,
,
, and
signature(x = "sbm_ci")
: Prints an sbm_ci
object; use summary(sbm_ci)
for results
signature(object = "sbm_ci")
: Prints an sbm_ci
object; use summary(sbm_ci)
for results
signature(object = "sbm_ci")
: Prints a summary of sbm_ci
objects (bootstrap confidence intervals for Swash-Backwash Model estimates)
Thomas Wieland
Swash-Backwash Model:
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
Bootstrapping und bootstrap confidence intervals:
Efron B, Tibshirani RJ (1993) An Introduction to the Bootstrap.
Ramachandran KM, Tsokos CP (2021) Mathematical Statistics with Applications in R (Third Edition). Ch. 13.3.1 (Bootstrap confidence intervals). doi:10.1016/B978-0-12-817815-7.00013-0
showClass("sbm_ci")
showClass("sbm_ci")
"sbm"
The class "sbm"
contains the results of the Swash-Backwash Model and the related input data as well as additional information. Use summary(sbm)
and plot(sbm)
for results summary and plotting, respectively.
Objects can be created by the function swash
.
R_0A
:Object of class "numeric"
Model result: spatial reproduction number
integrals
:Object of class "numeric"
Model result: integrals ,
, and
velocity
:Object of class "numeric"
Model result: velocity measures and
occ_regions
:Object of class "data.frame"
Model result: Occurence at regional level
SIR_regions
:Object of class "data.frame"
Model result: Susceptible, infected and recovered regions over time
cases_by_date
:Object of class "data.frame"
Total cases by date
cases_by_region
:Object of class "data.frame"
Cumulative cases by region
input_data
:Object of class "data.frame"
Input data
data_statistics
:Object of class "numeric"
Diagnostics of input data
col_names
:Object of class "character"
Original column names in input data
signature(object = "sbm")
: Creates bootstrap confidence intervals for sbm
objects.
signature(x = "sbm")
: Plots the results of the Swash-Backwash Model; two plots: edges over time, total infections per time unit
signature(x = "sbm")
: Prints an sbm
object; use summary(sbm)
for results
signature(object = "sbm")
: Prints an sbm
object; use summary(sbm)
for results
signature(object = "sbm")
: Prints a summary of sbm
objects (results of the Swash-Backwash Model)
Thomas Wieland
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
showClass("sbm")
showClass("sbm")
show
Methods for function show
signature(object = "sbm")
Prints an sbm
object; use summary(sbm)
for results
signature(object = "sbm_ci")
Prints an sbm_ci
object; use summary(sbm_ci)
for results
summary
Methods for function summary
signature(object = "sbm")
Prints a summary of sbm
objects (results of the Swash-Backwash Model)
signature(object = "sbm_ci")
Prints a summary of sbm_ci
objects (bootstrap confidence intervals for Swash-Backwash Model estimates)
signature(object = "countries")
Prints a summary of a countries
object built with the function compare_countries
Analysis of regional infection/surveillance data using the Swash-Backwash Model for the single epidemic wave by Cliff and Haggett (2006)
swash( data, col_cases, col_date, col_region )
swash( data, col_cases, col_date, col_region )
data |
|
col_cases |
Column containing the cases (numeric) |
col_date |
Column containing the time points (e.g., days) |
col_region |
Column containing the unique identifier of the regions (e.g., name, NUTS 3 code) |
The function performs the analysis of the input panel data using the Swash-Backwash Model. The output is an object of class "sbm"
. The results can be viewed using summary(sbm)
.
object of class sbm-class
Thomas Wieland
Cliff AD, Haggett P (2006) A swash-backwash model of the single epidemic wave. Journal of Geographical Systems 8(3), 227-252. doi:10.1007/s10109-006-0027-8
Smallman-Raynor MR, Cliff AD, Stickler PJ (2022) Meningococcal Meningitis and Coal Mining in Provincial England: Geographical Perspectives on a Major Epidemic, 1929–33. Geographical Analysis 54, 197–216. doi:10.1111/gean.12272
Smallman-Raynor MR, Cliff AD, The COVID-19 Genomics UK (COG-UK) Consortium (2022) Spatial growth rate of emerging SARS-CoV-2 lineages in England, September 2020–December 2021. Epidemiology and Infection 150, e145. doi:10.1017/S0950268822001285.
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) summary(CH_covidwave1) # Summary of Swash-Backwash Model plot(CH_covidwave1) # Plot of Swash-Backwash Model edges and total epidemic curve
data(COVID19Cases_geoRegion) # Get SWISS COVID19 cases at NUTS 3 level COVID19Cases_geoRegion <- COVID19Cases_geoRegion[!COVID19Cases_geoRegion$geoRegion %in% c("CH", "CHFL"),] # Exclude CH = Switzerland total and CHFL = Switzerland and Liechtenstein total COVID19Cases_geoRegion <- COVID19Cases_geoRegion[COVID19Cases_geoRegion$datum <= "2020-05-31",] # Extract first COVID-19 wave CH_covidwave1 <- swash ( data = COVID19Cases_geoRegion, col_cases = "entries", col_date = "datum", col_region = "geoRegion" ) # Swash-Backwash Model for Swiss COVID19 cases # Spatial aggregate: NUTS 3 (cantons) summary(CH_covidwave1) # Summary of Swash-Backwash Model plot(CH_covidwave1) # Plot of Swash-Backwash Model edges and total epidemic curve