Plot infection probability
plot_infection_probability.RdBoxplot of infection probability per year according to population exposed and pathogen simulated
Examples
# \donttest{
library(dplyr)
library(purrr)
scenario_test <- create_scenario(system.file("input_1culture_2pop.xlsx", package = "ambre"))
scenario_conc <- inflow_concentration(scenario = scenario_test,
pathogenName = c("Campylobacter jejuni", "Escherichia coli", "Norovirus", "Rotavirus"))
#> Simulated pathogen: Campylobacter jejuni
#> Create 1000 random distribution(s): uniform (n: 60, min: 100.000000, max: 5000.000000)
#> Simulated pathogen: Escherichia coli
#> Create 1000 random distribution(s): uniform (n: 60, min: 10000000.000000, max: 1000000000.000000)
#> Simulated pathogen: Norovirus
#> Create 1000 random distribution(s): uniform (n: 60, min: 0.000000, max: 1000000.000000)
#> Simulated pathogen: Rotavirus
#> Create 1000 random distribution(s): uniform (n: 60, min: 100.000000, max: 5000.000000)
#> Providing inflow events ... ok. (0.02 secs)
#> Providing inflow paras ... ok. (0.00 secs)
#> Simulated pathogen: Campylobacter jejuni
#> Create 1000 random distribution(s): uniform (n: 48, min: 100.000000, max: 5000.000000)
#> Simulated pathogen: Escherichia coli
#> Create 1000 random distribution(s): uniform (n: 48, min: 10000000.000000, max: 1000000000.000000)
#> Simulated pathogen: Norovirus
#> Create 1000 random distribution(s): uniform (n: 48, min: 0.000000, max: 1000000.000000)
#> Simulated pathogen: Rotavirus
#> Create 1000 random distribution(s): uniform (n: 48, min: 100.000000, max: 5000.000000)
#> Providing inflow events ... ok. (0.02 secs)
#> Providing inflow paras ... ok. (0.00 secs)
scenario_volume <-
scenario_conc |>
mutate(
volume = map(
.x = config,
.f = ~ simulate_exposure(config = .x)
)
)
#> Simulated exposure: volume per event
#> Distribution set from 'triangle' to 'uniform' because 'min' equals 'max'
#> Create 1000 random distribution(s): uniform (n: 60, min: 0.001000, max: 0.001000)
#> Simulated exposure: volume per event
#> Distribution set from 'triangle' to 'uniform' because 'min' equals 'max'
#> Create 1000 random distribution(s): uniform (n: 48, min: 0.001000, max: 0.001000)
scenario_dose_ini <- initial_dose_calculation(scenario_volume)
scenario_scheme <- update_treatment_scheme(scenario_dose_ini)
scenario_with_logreduc_and_co <- scenario_scheme |>
mutate( log_reduction = map(config, simulate_treatment))
#> Create 1000 random distribution(s): uniform (n: 60, min: 1.000000, max: 2.000000)
#> Create 1000 random distribution(s): uniform (n: 60, min: 1.000000, max: 2.000000)
#> Create 1000 random distribution(s): uniform (n: 60, min: 1.000000, max: 3.000000)
#> Create 1000 random distribution(s): uniform (n: 60, min: 1.000000, max: 2.000000)
#> Create 1000 random distribution(s): uniform (n: 60, min: 5.000000, max: 7.000000)
#> Create 1000 random distribution(s): uniform (n: 60, min: 2.000000, max: 4.000000)
#> Simulated treatment: Q.1 - Activated Sludge for Bacteria
#> Simulated treatment: Q.1 - Activated Sludge for Viruses
#> Simulated treatment: Q.2 - Maturation Pond for Bacteria
#> Simulated treatment: Q.2 - Maturation Pond for Viruses
#> Simulated treatment: Q.6 - Chlorination for Bacteria
#> Simulated treatment: Q.6 - Chlorination for Viruses
#> Simulated treatment: Q.1 - Activated Sludge for Bacteria
#> Simulated treatment: Q.1 - Activated Sludge for Viruses
#> Simulated treatment: Q.2 - Maturation Pond for Bacteria
#> Simulated treatment: Q.2 - Maturation Pond for Viruses
#> Simulated treatment: Q.6 - Chlorination for Bacteria
#> Simulated treatment: Q.6 - Chlorination for Viruses
#> Joining with `by = join_by(TreatmentID)`
#> Joining with `by = join_by(TreatmentID)`
#> Create 1000 random distribution(s): uniform (n: 48, min: 1.000000, max: 2.000000)
#> Create 1000 random distribution(s): uniform (n: 48, min: 1.000000, max: 2.000000)
#> Create 1000 random distribution(s): uniform (n: 48, min: 1.000000, max: 3.000000)
#> Create 1000 random distribution(s): uniform (n: 48, min: 1.000000, max: 2.000000)
#> Create 1000 random distribution(s): uniform (n: 48, min: 5.000000, max: 7.000000)
#> Create 1000 random distribution(s): uniform (n: 48, min: 2.000000, max: 4.000000)
#> Simulated treatment: Q.1 - Activated Sludge for Bacteria
#> Simulated treatment: Q.1 - Activated Sludge for Viruses
#> Simulated treatment: Q.2 - Maturation Pond for Bacteria
#> Simulated treatment: Q.2 - Maturation Pond for Viruses
#> Simulated treatment: Q.6 - Chlorination for Bacteria
#> Simulated treatment: Q.6 - Chlorination for Viruses
#> Simulated treatment: Q.1 - Activated Sludge for Bacteria
#> Simulated treatment: Q.1 - Activated Sludge for Viruses
#> Simulated treatment: Q.2 - Maturation Pond for Bacteria
#> Simulated treatment: Q.2 - Maturation Pond for Viruses
#> Simulated treatment: Q.6 - Chlorination for Bacteria
#> Simulated treatment: Q.6 - Chlorination for Viruses
#> Joining with `by = join_by(TreatmentID)`
#> Joining with `by = join_by(TreatmentID)`
scenario_final_dose_and_co_test <- final_dose_calculation(scenario_with_logreduc_and_co)
scenario_inf_proba_and_co <- infection_probability_calculation(scenario_final_dose_and_co_test)
scenario_illness_proba_and_co <- illness_probability_calculation(scenario_inf_proba_and_co)
scenario_dalys_and_co <- dalys_calculation(scenario_illness_proba_and_co)
scenario_risk_total_and_co <-get_risk_total(scenario_dalys_and_co)
plot_infection_probability(scenario_risk_total_and_co)
#> $`Campylobacter jejuni`
#>
#> $`Escherichia coli`
#>
#> $Norovirus
#>
#> $Rotavirus
#>
# }