Generates one row per district reached by a supplementary immunisation
activity round, shaped like the cleaned POLIS campaign table that
clean_sia() writes. Rounds start every round_interval_days from a
random first day, each with one vaccine type and one status, and each
district takes part in a round with probability share_districts. Every
country in the geography follows the same calendar of rounds.
Usage
simulate_campaigns(
admin = simulate_admin_frame(),
start_date = as.Date("2023-01-01"),
end_date = as.Date("2024-12-31"),
round_interval_days = 60,
round_days = 4,
share_districts = 0.8,
vaccine_types = c("bOPV", "nOPV2"),
vaccine_type_probs = c(0.7, 0.3),
statuses = c("Done", "Cancelled"),
status_probs = c(0.95, 0.05),
seed = 6L
)Arguments
- admin
A geography from
simulate_admin_frame(). Defaultsimulate_admin_frame().- start_date, end_date
The window in which rounds start. Defaults
as.Date("2023-01-01")andas.Date("2024-12-31").- round_interval_days
Days between the starts of two rounds. Default
60.- round_days
Length of a round in days. Default
4.Chance that a district takes part in a round. Default
0.8.- vaccine_types, vaccine_type_probs
Vaccine types a round can use and their weights. Defaults
c("bOPV", "nOPV2")andc(0.7, 0.3).- statuses, status_probs
Round statuses and their weights. Defaults
c("Done", "Cancelled")andc(0.95, 0.05).- seed
Seed for the random draws. Default
6L. The caller's random state is left as it was.
Value
A tibble with one row per round and district and the columns
sia_sub_activity_code, country_iso3code, adm0, adm1, adm2,
adm0_guid, adm1_guid, adm2_guid, activity_vaccine_type,
vaccine_type, activity_status, activity_date_from, date_from,
date_to, year_start and month_start. Dates are Date, the year
and month are integer and the other columns are character.
Details
The table carries the activity columns the environmental site scorecard
reads (es_score_cols()) and the sub-activity columns
calc_polio_indicators() reads, so vaccine_type repeats
activity_vaccine_type and date_from repeats activity_date_from.
Examples
admin <- simulate_admin_frame(n_provinces = 2, n_districts = 3)
campaigns <- simulate_campaigns(admin)
dplyr::count(campaigns, activity_vaccine_type)
#> # A tibble: 2 × 2
#> activity_vaccine_type n
#> <chr> <int>
#> 1 bOPV 28
#> 2 nOPV2 26
