| impute_missing_values | R Documentation |
Imputing missing values of infection numbers for infections panel data.
impute_missing_values(
object,
verbose = FALSE
)
object |
object of class |
verbose |
|
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).
infpan object with updated cases column
See the Data manipulation page in the
swash methodological handbook for details.
Thomas Wieland
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")}
infpan-class, load_infections_paneldata, calculate_rollsum,
calculate_Rt, calculate_cum, calculate_incidence
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.