diff --git a/NAMESPACE b/NAMESPACE index b5a7c879..c65a0d7d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,13 +1,10 @@ # Generated by roxygen2: do not edit by hand export(AL_params) -export(AL_params_falciparum) export(CQ_PQ_params_vivax) export(CQ_params_vivax) export(DHA_PQP_params) -export(DHA_PQP_params_falciparum) export(SP_AQ_params) -export(SP_AQ_params_falciparum) export(arab_params) export(create_pev_profile) export(fun_params) diff --git a/R/drug_parameters.R b/R/drug_parameters.R index 678c3e92..9b196e11 100644 --- a/R/drug_parameters.R +++ b/R/drug_parameters.R @@ -1,44 +1,24 @@ -#' @title Preset parameters for the DHA-PQP drug -#' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014) -#' @details Use a vector of preset parameters for the DHA-PQP drug (dihydroartemisinin-piperaquine) -#' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.09434, drug_prophylaxis_shape: 4.4, drug_prophylaxis_scale: 28.1 -#' @export -DHA_PQP_params_falciparum <- c(.95, 0.09434, 4.4, 28.1) - -#' @title Preset parameters for the DHA-PQP drug +#' @title Preset parameters for the DHA-PQP drug (P. falciparum) #' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014) #' @details Use a vector of preset parameters for the DHA-PQP drug (dihydroartemisinin-piperaquine) #' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.09434, drug_prophylaxis_shape: 4.4, drug_prophylaxis_scale: 28.1 #' @export DHA_PQP_params <- c(.95, 0.09434, 4.4, 28.1) -#' @title Preset parameters for the AL drug -#' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014) -#' @details Use a vector of preset parameters for the AL drug (artemether-lumefantrine) -#' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.05094, drug_prophylaxis_shape: 11.3, drug_prophylaxis_scale: 10.6 -#' @export -AL_params_falciparum <- c(.95, 0.05094, 11.3, 10.6) - -#' @title Preset parameters for the AL drug +#' @title Preset parameters for the AL drug (P. falciparum) #' @description From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014) #' @details Use a vector of preset parameters for the AL drug (artemether-lumefantrine) #' @details Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.05094, drug_prophylaxis_shape: 11.3, drug_prophylaxis_scale: 10.6 #' @export AL_params <- c(.95, 0.05094, 11.3, 10.6) -#' @title Preset parameters for the SP-AQ drug -#' @details Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine) -#' @details Default parameters, from L to R, are: drug_efficacy: 0.9, drug_rel_c: 0.32, drug_prophylaxis_shape: 4.3, drug_prophylaxis_scale: 38.1 -#' @export -SP_AQ_params_falciparum <- c(0.9, 0.32, 4.3, 38.1) - -#' @title Preset parameters for the SP-AQ drug +#' @title Preset parameters for the SP-AQ drug (P. falciparum) #' @details Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine) #' @details Default parameters, from L to R, are: drug_efficacy: 0.9, drug_rel_c: 0.32, drug_prophylaxis_shape: 4.3, drug_prophylaxis_scale: 38.1 #' @export SP_AQ_params <- c(0.9, 0.32, 4.3, 38.1) -#' @title Preset parameters for the CQ drug acting on P. vivax +#' @title Preset parameters for the CQ drug (P. vivax) #' @description Efficacy from SI of Nekkab et al., DOI: 10.1371/journal.pmed.1003535 (2021), #' shape and scale consistent with a longer prophylaxis time: 28 days, decreasing gradually #' @details Use a vector of preset parameters for the CQ drug (chloroquine) acting on P. vivax @@ -46,7 +26,7 @@ SP_AQ_params <- c(0.9, 0.32, 4.3, 38.1) #' @export CQ_params_vivax <- c(0.899, 0.5, 5, 20) -#' @title Preset parameters for the CQ-PQ drug acting on P. vivax +#' @title Preset parameters for the CQ-PQ drug (P. vivax) #' @description Efficacy from SI of Nekkab et al., DOI: 10.1371/journal.pmed.1003535 (2021), #' BS shape and scale consistent with a longer prophylaxis time: 28 days, decreasing gradually, #' LS shape are scale consistent with a 7 day PQ treatment, with rapid decay. @@ -56,7 +36,7 @@ CQ_params_vivax <- c(0.899, 0.5, 5, 20) #' @export CQ_PQ_params_vivax <- c(0.948, 0.5, 5, 20, 0.713, 10, 5.5) -#' @title Preset parameters for the CQ-TQ drug acting on P. vivax +#' @title Preset parameters for the CQ-TQ drug (P. vivax) #' @description Efficacy from SI of Nekkab et al., DOI: 10.1371/journal.pmed.1003535 (2021), #' BS shape and scale consistent with a longer prophylaxis time: 28 days, decreasing gradually, #' LS shape are scale consistent with a single TQ treatment, with longer prophylaxis: 45 days. @@ -83,6 +63,33 @@ set_drugs <- function(parameters, drugs) { 'drug_hypnozoite_prophylaxis_scale' ) + if(parameters$parasite == "falciparum"){ + for (drug in seq_along(drugs)) { + if(length(drugs[[drug]]) != 4){ + warning(paste0("Drug ", drug, " has incorrect number of P. falciparum drug parameters. The number of parameters should be 4."), + call. = FALSE) + } else if ( + all(drugs[[drug]] == CQ_params_vivax)){ + warning("P. vivax drug parameters are being applied to P. falciparum", + call. = FALSE) + } + } + } else if (parameters$parasite == "vivax"){ + for (drug in seq_along(drugs)) { + if(!length(drugs[[drug]]) %in% c(4, 7)){ + warning(paste0("Drug ", drug, " has incorrect number of P. vivax drug parameters. The number of parameters should be 4, for blood stage treatment only, or 7, for radical cure."), + call. = FALSE) + } else if(length(drugs[[drug]]) == 4){ + if(all(drugs[[drug]] == AL_params) | + all(drugs[[drug]] == DHA_PQP_params) | + all(drugs[[drug]] == SP_AQ_params)){ + warning("P. falciparum drug parameters are being applied to P. vivax.", + call. = FALSE) + } + } + } + } + for (drug in seq_along(drugs)) { for (i in seq_along(drugs[[drug]])) { parameters[[keys[[i]]]][drug] <- drugs[[drug]][[i]] diff --git a/R/human_infection.R b/R/human_infection.R index f949d956..f341f849 100644 --- a/R/human_infection.R +++ b/R/human_infection.R @@ -519,24 +519,12 @@ relapse_bite_infection_hazard_resolution <- function( ## all bitten humans with an infectious bite (incorporating prophylaxis) get a new batch of hypnozoites if(bite_infections$size()>0){ - ## drug prophylaxis may limit formation of new hypnozoite batches - ls_prophylaxis <- rep(0, bite_infections$size()) - if(length(parameters$drug_hypnozoite_efficacy) > 0){ - - ls_drug <- variables$ls_drug$get_values(bite_infections) - ls_medicated <- (ls_drug > 0) - ls_medicated[ls_drug > 0] <- !is.na(parameters$drug_hypnozoite_efficacy[ls_drug]) - - if (any(ls_medicated)) { - ls_drug <- ls_drug[ls_medicated] - ls_drug_time <- variables$ls_drug_time$get_values(bite_infections)[ls_medicated] - ls_prophylaxis[ls_medicated] <- weibull_survival( - timestep - ls_drug_time, - parameters$drug_hypnozoite_prophylaxis_shape[ls_drug], - parameters$drug_hypnozoite_prophylaxis_scale[ls_drug] - ) - } - } + ls_prophylaxis <- ls_treatment_prophylaxis_efficacy( + bite_infections, + variables, + parameters, + timestep + ) # make sure batches are capped new_hypnozoite_batch_formed <- bitset_at(bite_infections, bernoulli_multi_p(1 - ls_prophylaxis)) @@ -550,6 +538,42 @@ relapse_bite_infection_hazard_resolution <- function( } } +#' @title Calculate protection from formation of new hypnozoite batches due to liver stage drug prophylaxis +#' @description This function calculates the probability that liver stage drug prophylaxis will +#' protect each individual from the formation of new hynozoite batches +#' @param bite_infections a vector of individuals with prospective formation of new hypnozoite batches +#' @param variables a list of all of the model variables +#' @param parameters model parameters +#' @param timestep current timestep +#' @noRd +ls_treatment_prophylaxis_efficacy <- function( + bite_infections, + variables, + parameters, + timestep +){ + + ## drug prophylaxis may limit formation of new hypnozoite batches + ls_prophylaxis <- rep(0, bite_infections$size()) + if(length(parameters$drug_hypnozoite_efficacy) > 0){ + + ls_drug <- variables$ls_drug$get_values(bite_infections) + ls_medicated <- ls_drug > 0 + ls_medicated[ls_medicated] <- !is.na(parameters$drug_hypnozoite_efficacy[ls_drug]) + + if (any(ls_medicated)) { + ls_drug <- ls_drug[ls_medicated] + ls_drug_time <- variables$ls_drug_time$get_values(bite_infections)[ls_medicated] + ls_prophylaxis[ls_medicated] <- weibull_survival( + timestep - ls_drug_time, + parameters$drug_hypnozoite_prophylaxis_shape[ls_drug], + parameters$drug_hypnozoite_prophylaxis_scale[ls_drug] + ) + } + } + + ls_prophylaxis +} #' @title Calculate light microscopy detectable infections (p.v only) #' @description #' Sample light microscopy detectable infections from all infections diff --git a/man/AL_params.Rd b/man/AL_params.Rd index 01db8035..58519054 100644 --- a/man/AL_params.Rd +++ b/man/AL_params.Rd @@ -3,7 +3,7 @@ \docType{data} \name{AL_params} \alias{AL_params} -\title{Preset parameters for the AL drug} +\title{Preset parameters for the AL drug (P. falciparum)} \format{ An object of class \code{numeric} of length 4. } diff --git a/man/AL_params_falciparum.Rd b/man/AL_params_falciparum.Rd deleted file mode 100644 index 698f09e0..00000000 --- a/man/AL_params_falciparum.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/drug_parameters.R -\docType{data} -\name{AL_params_falciparum} -\alias{AL_params_falciparum} -\title{Preset parameters for the AL drug} -\format{ -An object of class \code{numeric} of length 4. -} -\usage{ -AL_params_falciparum -} -\description{ -From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014) -} -\details{ -Use a vector of preset parameters for the AL drug (artemether-lumefantrine) - -Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.05094, drug_prophylaxis_shape: 11.3, drug_prophylaxis_scale: 10.6 -} -\keyword{datasets} diff --git a/man/CQ_PQ_params_vivax.Rd b/man/CQ_PQ_params_vivax.Rd index a0938989..53f38dca 100644 --- a/man/CQ_PQ_params_vivax.Rd +++ b/man/CQ_PQ_params_vivax.Rd @@ -3,7 +3,7 @@ \docType{data} \name{CQ_PQ_params_vivax} \alias{CQ_PQ_params_vivax} -\title{Preset parameters for the CQ-PQ drug acting on P. vivax} +\title{Preset parameters for the CQ-PQ drug (P. vivax)} \format{ An object of class \code{numeric} of length 7. } diff --git a/man/CQ_TQ_params_vivax.Rd b/man/CQ_TQ_params_vivax.Rd index 72a66b37..37de802f 100644 --- a/man/CQ_TQ_params_vivax.Rd +++ b/man/CQ_TQ_params_vivax.Rd @@ -3,7 +3,7 @@ \docType{data} \name{CQ_TQ_params_vivax} \alias{CQ_TQ_params_vivax} -\title{Preset parameters for the CQ-TQ drug acting on P. vivax} +\title{Preset parameters for the CQ-TQ drug (P. vivax)} \format{ An object of class \code{numeric} of length 7. } diff --git a/man/CQ_params_vivax.Rd b/man/CQ_params_vivax.Rd index 3a7d192e..05cf7955 100644 --- a/man/CQ_params_vivax.Rd +++ b/man/CQ_params_vivax.Rd @@ -3,7 +3,7 @@ \docType{data} \name{CQ_params_vivax} \alias{CQ_params_vivax} -\title{Preset parameters for the CQ drug acting on P. vivax} +\title{Preset parameters for the CQ drug (P. vivax)} \format{ An object of class \code{numeric} of length 4. } diff --git a/man/DHA_PQP_params.Rd b/man/DHA_PQP_params.Rd index cce7690b..3732b68b 100644 --- a/man/DHA_PQP_params.Rd +++ b/man/DHA_PQP_params.Rd @@ -3,7 +3,7 @@ \docType{data} \name{DHA_PQP_params} \alias{DHA_PQP_params} -\title{Preset parameters for the DHA-PQP drug} +\title{Preset parameters for the DHA-PQP drug (P. falciparum)} \format{ An object of class \code{numeric} of length 4. } diff --git a/man/DHA_PQP_params_falciparum.Rd b/man/DHA_PQP_params_falciparum.Rd deleted file mode 100644 index c4c9ac6e..00000000 --- a/man/DHA_PQP_params_falciparum.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/drug_parameters.R -\docType{data} -\name{DHA_PQP_params_falciparum} -\alias{DHA_PQP_params_falciparum} -\title{Preset parameters for the DHA-PQP drug} -\format{ -An object of class \code{numeric} of length 4. -} -\usage{ -DHA_PQP_params_falciparum -} -\description{ -From SI of Commun. 5:5606 doi: 10.1038/ncomms6606 (2014) -} -\details{ -Use a vector of preset parameters for the DHA-PQP drug (dihydroartemisinin-piperaquine) - -Default parameters, from L to R, are: drug_efficacy: 0.95, drug_rel_c: 0.09434, drug_prophylaxis_shape: 4.4, drug_prophylaxis_scale: 28.1 -} -\keyword{datasets} diff --git a/man/SP_AQ_params.Rd b/man/SP_AQ_params.Rd index fc416c2f..6e30fde1 100644 --- a/man/SP_AQ_params.Rd +++ b/man/SP_AQ_params.Rd @@ -3,7 +3,7 @@ \docType{data} \name{SP_AQ_params} \alias{SP_AQ_params} -\title{Preset parameters for the SP-AQ drug} +\title{Preset parameters for the SP-AQ drug (P. falciparum)} \format{ An object of class \code{numeric} of length 4. } @@ -11,7 +11,7 @@ An object of class \code{numeric} of length 4. SP_AQ_params } \description{ -Preset parameters for the SP-AQ drug +Preset parameters for the SP-AQ drug (P. falciparum) } \details{ Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine) diff --git a/man/SP_AQ_params_falciparum.Rd b/man/SP_AQ_params_falciparum.Rd deleted file mode 100644 index 063aabfd..00000000 --- a/man/SP_AQ_params_falciparum.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/drug_parameters.R -\docType{data} -\name{SP_AQ_params_falciparum} -\alias{SP_AQ_params_falciparum} -\title{Preset parameters for the SP-AQ drug} -\format{ -An object of class \code{numeric} of length 4. -} -\usage{ -SP_AQ_params_falciparum -} -\description{ -Preset parameters for the SP-AQ drug -} -\details{ -Use a vector of preset parameters for the SP-AQ drug (sulphadoxine-pyrimethamine and amodiaquine) - -Default parameters, from L to R, are: drug_efficacy: 0.9, drug_rel_c: 0.32, drug_prophylaxis_shape: 4.3, drug_prophylaxis_scale: 38.1 -} -\keyword{datasets} diff --git a/tests/testthat/test-antimalarial-resistance.R b/tests/testthat/test-antimalarial-resistance.R index 4ed0afac..ae45a20e 100644 --- a/tests/testthat/test-antimalarial-resistance.R +++ b/tests/testthat/test-antimalarial-resistance.R @@ -1,6 +1,6 @@ test_that('set_antimalarial_resistance() toggles resistance on', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -21,7 +21,7 @@ test_that('set_antimalarial_resistance() toggles resistance on', { test_that('set_antimalarial_resistance() errors if parameter inputs of different length to timesteps', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -41,7 +41,7 @@ test_that('set_antimalarial_resistance() errors if parameter inputs of different test_that('set_antimalarial_resistance() errors if resistance proportions outside of range 0-1', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -62,7 +62,7 @@ test_that('set_antimalarial_resistance() errors if resistance proportions outsid test_that('set_antimalarial_resistance() errors if resistance phenotype probabilities outside bound of 0-1', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -82,7 +82,7 @@ test_that('set_antimalarial_resistance() errors if resistance phenotype probabil test_that('set_antimalarial_resistance() errors if drug index > than number of drugs assigned using set_drugs()', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -103,7 +103,7 @@ test_that('set_antimalarial_resistance() errors if drug index > than number of d test_that('set_antimalarial_resistance() assigns parameters correctly despite order in which resistance parameters are specified', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 2, timesteps = 1, coverages = 0.2) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0.1) parameters <- set_clinical_treatment(parameters = parameters, drug = 3, timesteps = 1, coverages = 0.4) @@ -158,7 +158,7 @@ test_that('set_antimalarial_resistance() assigns parameters correctly despite or test_that("set_antimalarial_resistance errors if length slow_parasite_clearance_time > 1", { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = c(0, 10), @@ -182,7 +182,7 @@ test_that("set_antimalarial_resistance errors if length slow_parasite_clearance_ test_that("set_antimalarial_resistance errors if slow_parasite_clearance_time not positive", { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = c(0, 10), @@ -206,7 +206,7 @@ test_that("set_antimalarial_resistance errors if slow_parasite_clearance_time no test_that('get_antimalarial_resistance_parameters() correctly retrieves parameters when multiple drugs assigned', { get_parameters(overrides = list(human_population = 10000)) |> - set_drugs(drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) |> + set_drugs(drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) |> set_clinical_treatment(drug = 1, timesteps = 1, coverages = 0.4) |> set_clinical_treatment(drug = 2, timesteps = 1, coverages = 0.3) |> set_clinical_treatment(drug = 3, timesteps = 1, coverages = 0.2) |> @@ -266,7 +266,7 @@ test_that('get_antimalarial_resistance_parameters() correctly retrieves paramete test_that('get_antimalarial_resistance_parameters() correctly retrieves parameters when not all drugs assigned resistance', { get_parameters(overrides = list(human_population = 10000)) %>% - set_drugs(drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) %>% + set_drugs(drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) %>% set_clinical_treatment(drug = 1, timesteps = 1, coverages = 0.4) %>% set_clinical_treatment(drug = 2, timesteps = 1, coverages = 0.3) %>% set_clinical_treatment(drug = 3, timesteps = 1, coverages = 0.2) %>% @@ -306,7 +306,7 @@ test_that('get_antimalarial_resistance_parameters() correctly retrieves paramete test_that('get_antimalarial_resistance_parameters() returns an error when antimalarial resistance has not been parameterised', { get_parameters(overrides = list(human_population = 10000)) %>% - set_drugs(drugs = list(AL_params_falciparum, SP_AQ_params_falciparum, DHA_PQP_params_falciparum)) %>% + set_drugs(drugs = list(AL_params, SP_AQ_params, DHA_PQP_params)) %>% set_clinical_treatment(drug = 1, timesteps = 1, coverages = 0.4) %>% set_clinical_treatment(drug = 2, timesteps = 1, coverages = 0.3) %>% set_clinical_treatment(drug = 3, timesteps = 1, coverages = 0.2) %>% diff --git a/tests/testthat/test-infection-integration.R b/tests/testthat/test-infection-integration.R index c9c5921f..a4bcd1ab 100644 --- a/tests/testthat/test-infection-integration.R +++ b/tests/testthat/test-infection-integration.R @@ -172,7 +172,7 @@ test_that('simulate_infection integrates different types of infection and schedu test_that('calculate_infections works various combinations of drug and vaccination', { timestep <- 50 parameters <- get_parameters() - parameters <- set_drugs(parameters, list(AL_params_falciparum, DHA_PQP_params_falciparum)) + parameters <- set_drugs(parameters, list(AL_params, DHA_PQP_params)) parameters <- set_clinical_treatment(parameters, 2, 1, .5) parameters <- set_mass_pev( parameters, @@ -313,7 +313,7 @@ test_that('calculate_clinical_infections correctly samples clinically infected', test_that('calculate_treated correctly samples treated and updates the drug state', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(AL_params_falciparum, DHA_PQP_params_falciparum)) + parameters <- set_drugs(parameters, list(AL_params, DHA_PQP_params)) parameters <- set_clinical_treatment(parameters, 1, 1, .25) parameters <- set_clinical_treatment(parameters, 2, 1, .25) timestep <- 5 @@ -380,7 +380,7 @@ test_that('calculate_treated correctly samples treated and updates the drug stat test_that('calculate_treated correctly samples treated and updates the drug state when resistance set', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0.25) parameters <- set_clinical_treatment(parameters = parameters, drug = 2, timesteps = 1, coverages = 0.25) parameters <- set_antimalarial_resistance(parameters = parameters, @@ -496,7 +496,7 @@ test_that('calculate_treated correctly samples treated and updates the drug stat # Establish the parameters parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0.25) parameters <- set_clinical_treatment(parameters = parameters, drug = 2, timesteps = 1, coverages = 0.25) parameters <- set_antimalarial_resistance(parameters = parameters, @@ -680,7 +680,7 @@ test_that('schedule_infections correctly schedules new infections', { test_that('prophylaxis is considered for medicated humans', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(AL_params_falciparum, DHA_PQP_params_falciparum)) + parameters <- set_drugs(parameters, list(AL_params, DHA_PQP_params)) events <- create_events(parameters) timestep <- 50 @@ -879,7 +879,7 @@ test_that('update_severe_disease renders with no infections', { test_that('calculate_treated returns empty Bitset when there is no clinical treatment coverage', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 0) parameters <- set_antimalarial_resistance(parameters = parameters, drug = 1, @@ -915,7 +915,7 @@ test_that('calculate_treated returns empty Bitset when there is no clinical trea test_that('calculate_treated returns empty Bitset when the clinically_infected input is an empty Bitset', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 1) parameters <- set_antimalarial_resistance(parameters = parameters, drug = 1, @@ -976,7 +976,7 @@ test_that('calculate_treated() returns an empty Bitset when the parameter list c test_that('Number of treatment failures matches number of individuals treated when artemisinin resistance proportion and early treatment failure probability both set to 1', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum, SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params, SP_AQ_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, @@ -1030,7 +1030,7 @@ test_that('Number of treatment failures matches number of individuals treated wh test_that('calculate_treated() successfully adds additional resistance columns to the renderer', { parameters <- get_parameters() - parameters <- set_drugs(parameters = parameters, drugs = list(AL_params_falciparum)) + parameters <- set_drugs(parameters = parameters, drugs = list(AL_params)) parameters <- set_clinical_treatment(parameters = parameters, drug = 1, timesteps = 1, coverages = 1) parameters <- set_antimalarial_resistance(parameters = parameters, drug = 1, diff --git a/tests/testthat/test-mda.R b/tests/testthat/test-mda.R index 904d242a..f2ec9c68 100644 --- a/tests/testthat/test-mda.R +++ b/tests/testthat/test-mda.R @@ -58,7 +58,7 @@ test_that('MDA moves the diseased and non-diseased population correctly', { timestep <- 50 renderer <- individual::Render$new(timestep) parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters, list(SP_AQ_params)) parameters <- set_mda( parameters, drug = 1, @@ -123,7 +123,7 @@ test_that('MDA moves the diseased and non-diseased population correctly', { expect_bitset_update( variables$infectivity$queue_update_mock(), - c(.3) * SP_AQ_params_falciparum[[2]], + c(.3) * SP_AQ_params[[2]], c(3) ) @@ -150,7 +150,7 @@ test_that('MDA moves the diseased and non-diseased population correctly - second timestep <- 150 renderer <- individual::Render$new(timestep) parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters, list(SP_AQ_params)) parameters <- set_mda( parameters, drug = 1, @@ -213,7 +213,7 @@ test_that('MDA moves the diseased and non-diseased population correctly - second expect_bitset_update( variables$infectivity$queue_update_mock(), - c(.1, .3) * SP_AQ_params_falciparum[[2]], + c(.1, .3) * SP_AQ_params[[2]], c(1, 3) ) @@ -254,7 +254,7 @@ test_that('MDA ignores non-detectable asymptomatics', { timestep <- 150 renderer <- individual::Render$new(timestep) parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters, list(SP_AQ_params)) parameters <- set_mda( parameters, drug = 1, @@ -312,7 +312,7 @@ test_that('MDA ignores non-detectable asymptomatics', { expect_bitset_update( variables$infectivity$queue_update_mock(), - c(.1) * SP_AQ_params_falciparum[[2]], + c(.1) * SP_AQ_params[[2]], c(1) ) diff --git a/tests/testthat/test-mortality-integration.R b/tests/testthat/test-mortality-integration.R index 7d914971..6ea850e7 100644 --- a/tests/testthat/test-mortality-integration.R +++ b/tests/testthat/test-mortality-integration.R @@ -1,7 +1,7 @@ test_that('mortality_process resets humans correctly', { timestep <- 2 parameters <- get_parameters(list(human_population = 4)) - parameters <- set_drugs(parameters, list(SP_AQ_params_falciparum)) + parameters <- set_drugs(parameters, list(SP_AQ_params)) parameters <- set_mda( parameters, drug = 1, diff --git a/tests/testthat/test-pmc.R b/tests/testthat/test-pmc.R index 4ff421c8..cc68f09a 100644 --- a/tests/testthat/test-pmc.R +++ b/tests/testthat/test-pmc.R @@ -9,7 +9,7 @@ test_that("pmc parameterisation works", { p <- set_drugs( parameters = p, - drugs = list(SP_AQ_params_falciparum)) + drugs = list(SP_AQ_params)) p <- set_pmc( parameters = p, drug = 1, @@ -50,7 +50,7 @@ test_that("pmc gives drugs to correct ages", { p <- get_parameters(list(human_population = 6)) p <- set_drugs( parameters = p, - drugs = list(SP_AQ_params_falciparum)) + drugs = list(SP_AQ_params)) p <- set_pmc( parameters = p, diff --git a/tests/testthat/test-resume.R b/tests/testthat/test-resume.R index a9068976..954fd063 100644 --- a/tests/testthat/test-resume.R +++ b/tests/testthat/test-resume.R @@ -131,7 +131,7 @@ test_that("TBV intervention can be added when resuming", { test_that("MDA intervention can be added when resuming", { set_default_mda <- function(parameters, timesteps) { - parameters %>% set_drugs(list(SP_AQ_params_falciparum)) %>% set_mda( + parameters %>% set_drugs(list(SP_AQ_params)) %>% set_mda( drug = 1, timesteps = timesteps, coverages = rep(0.8, length(timesteps)), @@ -217,7 +217,7 @@ test_that("Correlations can be set when resuming with new interventions", { coverage=tbv_coverage, ages=0:200) - drug <- SP_AQ_params_falciparum + drug <- SP_AQ_params drug[1] <- 1. # Override the drug efficacy to 100% parameters <- warmup_parameters %>% set_drugs(list(drug)) %>% diff --git a/tests/testthat/test-treatment.R b/tests/testthat/test-treatment.R index 26d5a89d..9e40c0da 100644 --- a/tests/testthat/test-treatment.R +++ b/tests/testthat/test-treatment.R @@ -1,7 +1,7 @@ test_that('You can set time varying clinical treatment', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(DHA_PQP_params_falciparum, AL_params_falciparum)) + parameters <- set_drugs(parameters, list(DHA_PQP_params, AL_params)) parameters <- set_clinical_treatment( parameters, drug = 1, @@ -62,7 +62,7 @@ test_that('You can set time varying clinical treatment', { test_that('You cannot set invalid coverages', { parameters <- get_parameters() - parameters <- set_drugs(parameters, list(DHA_PQP_params_falciparum, AL_params_falciparum)) + parameters <- set_drugs(parameters, list(DHA_PQP_params, AL_params)) parameters <- set_clinical_treatment( parameters, drug = 1, @@ -82,7 +82,7 @@ test_that('You cannot set invalid coverages', { test_that('set_drugs errors if a list is not provided', { parameters <- get_parameters() expect_error( - set_drugs(parameters, AL_params_falciparum), + set_drugs(parameters, AL_params), "is.list(drugs) is not TRUE", fixed = TRUE ) diff --git a/tests/testthat/test-vivax.R b/tests/testthat/test-vivax.R index 4b14f2ad..1fc629f1 100644 --- a/tests/testthat/test-vivax.R +++ b/tests/testthat/test-vivax.R @@ -314,3 +314,68 @@ test_that('relapses are recognised with division between bite infections and rel ) }) + +test_that('Drug functions provide warnings if applied incorrectly', { + + expect_warning( + get_parameters(parasite = "falciparum") |> + set_drugs(drugs = list(c(1,2,3,4,5))), + "Drug 1 has incorrect number of P. falciparum drug parameters. The number of parameters should be 4." + ) + + expect_warning( + get_parameters(parasite = "vivax") |> + set_drugs(drugs = list(c(1,2,3,4,5))), + "Drug 1 has incorrect number of P. vivax drug parameters. The number of parameters should be 4, for blood stage treatment only, or 7, for radical cure." + ) + + expect_warning( + get_parameters(parasite = "falciparum") |> + set_drugs(drugs = list(CQ_params_vivax)), + regexp = "P. vivax drug parameters are being applied to P. falciparum" + ) + + expect_warning( + get_parameters(parasite = "vivax") |> + set_drugs(drugs = list(AL_params)), + "P. falciparum drug parameters are being applied to P. vivax" + ) + +}) + +test_that('Liver stage prophylaxis functions correctly', { + + bite_infections <- individual::Bitset$new(4)$insert(1:4) + + variables <- list( + ls_drug = individual::DoubleVariable$new(c(0,1,2,3)), + ls_drug_time = individual::DoubleVariable$new(c(-1,1,1,1)) + ) + + parms <- get_parameters(parasite = "vivax") |> + set_drugs(drugs = list(CQ_params_vivax, CQ_PQ_params_vivax, CQ_TQ_params_vivax)) |> + set_clinical_treatment(drug = 1, timesteps = 0, coverages = 0.3) |> + set_clinical_treatment(drug = 2, timesteps = 0, coverages = 0.3) |> + set_clinical_treatment(drug = 3, timesteps = 0, coverages = 0.3) + + timestep <- 6 + + ls_prophylaxis <- ls_treatment_prophylaxis_efficacy( + bite_infections, + variables, + parms, + timestep + ) + + expect_identical( + ls_prophylaxis, + c(0, 0, + weibull_survival( + c(5,5), + parms$drug_hypnozoite_prophylaxis_shape[c(2, 3)], + parms$drug_hypnozoite_prophylaxis_scale[c(2, 3)] + ) + ) + ) + +}) diff --git a/vignettes/Antimalarial_Resistance.Rmd b/vignettes/Antimalarial_Resistance.Rmd index dea04c77..3bd2fb1a 100644 --- a/vignettes/Antimalarial_Resistance.Rmd +++ b/vignettes/Antimalarial_Resistance.Rmd @@ -36,7 +36,7 @@ Simulations capturing the effects of resistance to clinical treatment using anti To illustrate how to parameterise resistance to an ACT using the `set_antimalarial_resistance()` function, we'll set-up and run three simulations. The first simulates malaria transmission in the absence of interventions or resistance. The second simulates a simple regime of clinical treatment in which 80% of clinical cases are treated with artemether lumefantrine (AL), beginning after one year, in the absence of antimalarial resistance. The third simulates the same clinical treatment programme but with resistance to the artemisinin component of AL emerging after two years. For illustrative purposes, we assume that the proportion of infections resistant to the artemisinin component of AL increases from 0% to 80%, and that these infections have a 90% chance of resulting in early treatment failure. ### Parameterisation -First, we load the default `malariasimulation` model parameters, using the `overrides` argument to increase the human population. The human and mosquito population parameters are then calibrated to a user-specified initial EIR using the `set_equilibrium()` function. Next, we load the in-built parameters for the antimalarial drug AL and append them to the parameter list using `set_drugs()`. We can then use `set_clinical_treatment()` to specify a clinical treatment regime, beginning after one year, that treats, on average, 80% of the clinical cases of malaria with AL (`AL_params_falciparum`). The `set_antimalarial_resistance()` function is then used to specify a scenario in which resistance is initially absent from the population, but after two years the proportion of malaria infections that are resistant to the artemisinin component of AL rises to 80%. We also set the probability that artemisinin-resistant infections result in early treatment failure to 0.9. In the current instance, we've set the proportion of infections resistant to the AL partner drug to 0% and the probabilities of other resistant infection outcomes to zero for simplicity. +First, we load the default `malariasimulation` model parameters, using the `overrides` argument to increase the human population. The human and mosquito population parameters are then calibrated to a user-specified initial EIR using the `set_equilibrium()` function. Next, we load the in-built parameters for the antimalarial drug AL and append them to the parameter list using `set_drugs()`. We can then use `set_clinical_treatment()` to specify a clinical treatment regime, beginning after one year, that treats, on average, 80% of the clinical cases of malaria with AL (`AL_params`). The `set_antimalarial_resistance()` function is then used to specify a scenario in which resistance is initially absent from the population, but after two years the proportion of malaria infections that are resistant to the artemisinin component of AL rises to 80%. We also set the probability that artemisinin-resistant infections result in early treatment failure to 0.9. In the current instance, we've set the proportion of infections resistant to the AL partner drug to 0% and the probabilities of other resistant infection outcomes to zero for simplicity. ```{r, eval = TRUE} @@ -62,7 +62,7 @@ simparams <- get_parameters( simparams <- set_equilibrium(parameters = simparams, init_EIR = init_EIR) # Append the parameters for artemether lumefantrine (AL) to the parameter list: -simparams_clin_treatment <- set_drugs(parameters = simparams, drugs = list(AL_params_falciparum)) +simparams_clin_treatment <- set_drugs(parameters = simparams, drugs = list(AL_params)) # Use the set_clinical_treatment() function to specify a treatment regime for AL: simparams_clin_treatment <- set_clinical_treatment(parameters = simparams_clin_treatment, @@ -153,7 +153,7 @@ In the absence of clinical treatment or resistance, prevalence is comparable bet We can also capture scenarios in which resistance to a drug changes through time. To illustrate, we'll establish and simulate a scenario in which resistance to sulfadoxine-pyrimethamine amodiaquine (SP-AQ) is absent from the population in the first year, but emerges in the third year and doubles in proportion each year thereafter until 100% of infections are artemisinin resistant. For simplicity, we'll assume only artemisinin resistance is present in the population, and resistance to artemisinin results only, and always, in early treatment failure. ### Parameterisation -First, we store in vectors the artemisinin resistance proportions and the time steps on which they will be updated in the simulation. We also create a vector of early treatment failure probabilities which, for simplicity, we assume remain at 1 for each update. Next, we load the default `malariasimulation` parameter set, specifying a larger population size and seasonal transmission, and append the parameters for SP-AQ (`SP_AQ_params_falciparum`) using the `set_drugs()` function. We'll specify a simple treatment regimen using `set_clinical_treatment()` where, on average, 80% of clinical cases are treated with SP-AQ, beginning after one year. We then specify a resistance schedule in which artemisinin resistance is introduced at a proportion of 0.2 after 3 years, and doubles each year thereafter until all infections are artemisinin resistant. Finally, we calibrate the human and mosquito population parameters to a defined entomological inoculation rate (EIR) and are ready to run the simulation. +First, we store in vectors the artemisinin resistance proportions and the time steps on which they will be updated in the simulation. We also create a vector of early treatment failure probabilities which, for simplicity, we assume remain at 1 for each update. Next, we load the default `malariasimulation` parameter set, specifying a larger population size and seasonal transmission, and append the parameters for SP-AQ (`SP_AQ_params`) using the `set_drugs()` function. We'll specify a simple treatment regimen using `set_clinical_treatment()` where, on average, 80% of clinical cases are treated with SP-AQ, beginning after one year. We then specify a resistance schedule in which artemisinin resistance is introduced at a proportion of 0.2 after 3 years, and doubles each year thereafter until all infections are artemisinin resistant. Finally, we calibrate the human and mosquito population parameters to a defined entomological inoculation rate (EIR) and are ready to run the simulation. ```{r, eval = TRUE} @@ -183,7 +183,7 @@ simparams <- get_parameters( )) # Append the parameters for sulfadomamine pyrimethaine (SP-AQ) to the parameter list: -simparams <- set_drugs(parameters = simparams, drugs = list(SP_AQ_params_falciparum)) +simparams <- set_drugs(parameters = simparams, drugs = list(SP_AQ_params)) # Use the set_clinical_treatment() function to specify a treatment regime for SP-AQ: simparams <- set_clinical_treatment(parameters = simparams, @@ -278,7 +278,7 @@ get_parameters(overrides = list(human_population = 1000)) -> simulation_paramete # Establish a parameter list with clinical treatment starting after one year: simulation_parameters$base |> - set_drugs(drugs = list(AL_params_falciparum)) |> + set_drugs(drugs = list(AL_params)) |> set_clinical_treatment(drug = 1, timesteps = (365 * 1) + 1, coverages = c(0.8)) |> set_equilibrium(init_EIR = 16) -> simulation_parameters$treatment diff --git a/vignettes/EIRprevmatch.Rmd b/vignettes/EIRprevmatch.Rmd index 5f9101fa..cdf46b21 100644 --- a/vignettes/EIRprevmatch.Rmd +++ b/vignettes/EIRprevmatch.Rmd @@ -103,7 +103,7 @@ simparams <- set_species(parameters = simparams, # Use the set_drugs() function to append the in-built parameters for the # drug artemether lumefantrine (AL): -simparams <- set_drugs(simparams, list(AL_params_falciparum)) +simparams <- set_drugs(simparams, list(AL_params)) # Use the set_clinical_treatment() function to parameterise human # population treatment with AL in the first timestep: diff --git a/vignettes/MDA.Rmd b/vignettes/MDA.Rmd index bd38d15a..2da93a6e 100644 --- a/vignettes/MDA.Rmd +++ b/vignettes/MDA.Rmd @@ -63,7 +63,7 @@ simparams <- set_equilibrium(simparams, starting_EIR) ### Interventions -Having established a base set of parameters (`simparams`), the next step is to add the parameters specifying the MDA campaign. We first use the `set_drugs()` function to update the parameter list (`simparams`) with the parameter values for the drug(s) we wish to simulate, in this case using the in-built parameter set for SP-AQ (`SP_AQ_params_falciparum`). Note that the `malariasimulation` package also contains in-built parameter sets for dihydroartemisinin-piperaquine (`DHA_PQP_params_falciparum`) and artemether lumefantrine (`AL_params_falciparum`), and users can also define their own drug parameters. +Having established a base set of parameters (`simparams`), the next step is to add the parameters specifying the MDA campaign. We first use the `set_drugs()` function to update the parameter list (`simparams`) with the parameter values for the drug(s) we wish to simulate, in this case using the in-built parameter set for SP-AQ (`SP_AQ_params`). Note that the `malariasimulation` package also contains in-built parameter sets for dihydroartemisinin-piperaquine (`DHA_PQP_params`) and artemether lumefantrine (`AL_params`), and users can also define their own drug parameters. We then define the time steps on which we want the MDA to occur (stored here in the vector `mda_events` for legibility), and use the `set_mda()` function to update the parameter list with our MDA campaign parameters. `set_mda()` takes as its first two arguments the base parameter list and the time steps on which to schedule MDA events. This function also requires the user to specify the proportion of the population they want to treat using `coverages`, as well as the age-range of the population we want to treat using `min_ages` and `max_ages`, *for each timestep on which MDA is scheduled*. Note that this enables users to specify individual events to have different drug, coverage, and human-target properties. The `drug` argument refers to the index of the drug we want to distribute in the MDA in the list of parameters (in this demonstration we have only added a single drug, SP-AQ, using `set_drugs()`, but we could have specified additional drugs). @@ -73,7 +73,7 @@ mdaparams <- simparams # Update the parameter list with the default parameters for sulphadoxine-pyrimethamine # amodiaquine (SP-AQ) -mdaparams <- set_drugs(mdaparams, list(SP_AQ_params_falciparum)) +mdaparams <- set_drugs(mdaparams, list(SP_AQ_params)) # Specify the days on which to administer the SP-AQ mda_events <- (c(1, 2) * 365) @@ -180,7 +180,7 @@ While the first step would typically be to establish the base set of parameters, smcparams <- simparams # Append the parameters for SP-AQ using set_drugs -smcparams <- set_drugs(smcparams, list(SP_AQ_params_falciparum)) +smcparams <- set_drugs(smcparams, list(SP_AQ_params)) # Use the peak_season_offset() to calculate the yearly offset (in daily timesteps) for the peak mosq. # season diff --git a/vignettes/Metapopulation.Rmd b/vignettes/Metapopulation.Rmd index 5101d5d6..0f3bf776 100644 --- a/vignettes/Metapopulation.Rmd +++ b/vignettes/Metapopulation.Rmd @@ -47,7 +47,7 @@ ms_parameterize <- function(x){ # index of EIR individual_mosquitoes = FALSE)) # setting treatment - params <- set_drugs(params, list(AL_params_falciparum)) + params <- set_drugs(params, list(AL_params)) params <- set_clinical_treatment(params, drug = 1, timesteps = 1, coverages = 0.40) params <- set_equilibrium(params, init_EIR = EIR_vector[x]) diff --git a/vignettes/Treatment.Rmd b/vignettes/Treatment.Rmd index c3e68d64..03efa301 100644 --- a/vignettes/Treatment.Rmd +++ b/vignettes/Treatment.Rmd @@ -27,9 +27,9 @@ This vignette describes how to implement clinical drug treatments in malariasimu The malariasimulation package contains built-in parameters sets for three anti-malarial drugs: -1. `AL_params_falciparum`: artemether-lumefantrine (AL) -2. `DHA_PQP_params_falciparum`: dihydroartemisinin and piperaquine (DHA-PQP) -3. `SP_AQ_params_falciparum`: sulfadoxine-pyrimethamine and amodiaquine (SP-AQ) +1. `AL_params`: artemether-lumefantrine (AL) +2. `DHA_PQP_params`: dihydroartemisinin and piperaquine (DHA-PQP) +3. `SP_AQ_params`: sulfadoxine-pyrimethamine and amodiaquine (SP-AQ) While all these drugs can be used to treat malaria, DHA-PQP and SP-AQ remain in the body for some time following treatment, making them good candidates for chemoprevention in mass drug administrations (see [Mass Drug Administration and Chemoprevention](https://mrc-ide.github.io/malariasimulation/articles/MDA.html)). Any of these drugs can be included in the parameter list using the `set_drugs()` function (see [drugs_parameters.R](https://github.com/mrc-ide/malariasimulation/blob/master/R/drug_parameters.R) for full parameter details). @@ -46,7 +46,7 @@ calc_P <- function(w, lambda, t){ t <- 1:70 -P_matrix <- lapply(list(AL_params_falciparum, DHA_PQP_params_falciparum, SP_AQ_params_falciparum), function(x){ +P_matrix <- lapply(list(AL_params, DHA_PQP_params, SP_AQ_params), function(x){ calc_P(w = x[3], lambda = x[4], t = t) }) @@ -94,7 +94,7 @@ human_population <- 1000 simparams <- get_parameters(overrides = list(human_population = human_population)) # Update parameter set with chosen drug-specific parameters (AL and DHA/PQP) -drug_params <- set_drugs(simparams, list(AL_params_falciparum, DHA_PQP_params_falciparum)) +drug_params <- set_drugs(simparams, list(AL_params, DHA_PQP_params)) # Choose initial EIR to 10 starting_EIR <- 10