impute_missing_values: Imputing Missing Values in Infection Numbers

impute_missing_valuesR Documentation

Imputing Missing Values in Infection Numbers

Description

Imputing missing values of infection numbers for infections panel data.

Usage

impute_missing_values(
  object,
  verbose = FALSE
  )

Arguments

object

object of class infpan

verbose

bool argument which indicates whether progress messages are displayed

Details

Imputes missing values of the cases column in the infections panel data for each region. The method uses the function na.approx() from the zoo package (see the corresponding documentation).

Value

infpan object with updated cases column

Note

See the Data manipulation page in the swash methodological handbook for details.

Author(s)

Thomas Wieland

References

Jahangiri M, Kazemnejad A, Goldfeld KS, Daneshpour MS, Mostafaei S, Khalili D, Moghadas MR, Akbarzadeh M. (2023) A wide range of missing imputation approaches in longitudinal data: a simulation study and real data analysis. BMC Medical Research Methodology 23(1), 161. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1186/s12874-023-01968-8")}

Zeileis A, Grothendieck G (2005) zoo: S3 Infrastructure for Regular and Irregular Time Series. Journal of Statistical Software 14(6), 1–27. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.18637/jss.v014.i06")}

See Also

infpan-class, load_infections_paneldata, calculate_rollsum, calculate_Rt, calculate_cum, calculate_incidence

Examples

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

infpan_CH <- load_infections_paneldata(
    data = COVID19Cases_geoRegion,
    col_cases = "entries",
    col_date = "datum",
    col_region = "geoRegion",
    other_cols = c("Population" = "pop"), 
    verbose = TRUE
  )
# Import as infections panel data set (class infpan)

infpan_CH <-
  impute_missing_values(
    infpan_CH,
    verbose = TRUE
    )
# Imputing missing values
# (Note that there are no missing values in this data --> Warning)

swash documentation built on Nov. 28, 2026, 5:14 p.m.