From 8db706a0e047ec8c9400db29a0e81260d5fc385d Mon Sep 17 00:00:00 2001 From: smitdave Date: Fri, 1 Dec 2023 20:11:39 +0300 Subject: [PATCH] Output terms A change to the way the output terms are computed. Now compute_***_default computes the EIR, kappa, fqZ, and NI. + Minor bug fix. --- NAMESPACE | 44 ++++ R/aquatic-basic.R | 2 +- R/compute.R | 448 ++++++++++++++++++++++++++++++++++ R/diffeqn.R | 19 +- R/setup.R | 43 +--- R/utils.R | 58 +---- _pkgdown.yml | 46 ++++ man/compute_EIR.Rd | 20 ++ man/compute_EIR.aqua.Rd | 19 ++ man/compute_EIR.aqua_dde.Rd | 19 ++ man/compute_EIR.cohort.Rd | 19 ++ man/compute_EIR.dde.Rd | 19 ++ man/compute_EIR.human.Rd | 19 ++ man/compute_EIR.mosy.Rd | 19 ++ man/compute_EIR.mosy_dde.Rd | 19 ++ man/compute_EIR.ode.Rd | 19 ++ man/compute_EIR_default.Rd | 20 ++ man/compute_EIR_i.Rd | 22 ++ man/compute_NI.Rd | 20 ++ man/compute_NI.aqua.Rd | 19 ++ man/compute_NI.aqua_dde.Rd | 19 ++ man/compute_NI.cohort.Rd | 19 ++ man/compute_NI.dde.Rd | 19 ++ man/compute_NI.human.Rd | 19 ++ man/compute_NI.mosy.Rd | 19 ++ man/compute_NI.mosy_dde.Rd | 19 ++ man/compute_NI.ode.Rd | 19 ++ man/compute_NI_default.Rd | 20 ++ man/compute_NI_i.Rd | 22 ++ man/compute_fqZ.Rd | 20 ++ man/compute_fqZ.aqua.Rd | 19 ++ man/compute_fqZ.aqua_dde.Rd | 19 ++ man/compute_fqZ.cohort.Rd | 19 ++ man/compute_fqZ.dde.Rd | 19 ++ man/compute_fqZ.human.Rd | 19 ++ man/compute_fqZ.mosy.Rd | 19 ++ man/compute_fqZ.mosy_dde.Rd | 19 ++ man/compute_fqZ.ode.Rd | 19 ++ man/compute_fqZ_default.Rd | 20 ++ man/compute_fqZ_i.Rd | 22 ++ man/compute_kappa.Rd | 20 ++ man/compute_kappa.aqua.Rd | 19 ++ man/compute_kappa.aqua_dde.Rd | 19 ++ man/compute_kappa.cohort.Rd | 19 ++ man/compute_kappa.dde.Rd | 19 ++ man/compute_kappa.human.Rd | 19 ++ man/compute_kappa.mosy.Rd | 19 ++ man/compute_kappa.mosy_dde.Rd | 19 ++ man/compute_kappa.ode.Rd | 19 ++ man/compute_kappa_default.Rd | 20 ++ man/compute_kappa_i.Rd | 22 ++ man/xde_setup.Rd | 14 +- man/xde_setup_cohort.Rd | 8 +- man/xde_setup_human.Rd | 14 +- vignettes/adult_RM.Rmd | 6 +- vignettes/ex_534.Rmd | 8 +- vignettes/human_hmoi.Rmd | 6 +- vignettes/human_sip.Rmd | 6 +- vignettes/human_sis.Rmd | 6 +- 59 files changed, 1413 insertions(+), 171 deletions(-) create mode 100644 R/compute.R create mode 100644 man/compute_EIR.Rd create mode 100644 man/compute_EIR.aqua.Rd create mode 100644 man/compute_EIR.aqua_dde.Rd create mode 100644 man/compute_EIR.cohort.Rd create mode 100644 man/compute_EIR.dde.Rd create mode 100644 man/compute_EIR.human.Rd create mode 100644 man/compute_EIR.mosy.Rd create mode 100644 man/compute_EIR.mosy_dde.Rd create mode 100644 man/compute_EIR.ode.Rd create mode 100644 man/compute_EIR_default.Rd create mode 100644 man/compute_EIR_i.Rd create mode 100644 man/compute_NI.Rd create mode 100644 man/compute_NI.aqua.Rd create mode 100644 man/compute_NI.aqua_dde.Rd create mode 100644 man/compute_NI.cohort.Rd create mode 100644 man/compute_NI.dde.Rd create mode 100644 man/compute_NI.human.Rd create mode 100644 man/compute_NI.mosy.Rd create mode 100644 man/compute_NI.mosy_dde.Rd create mode 100644 man/compute_NI.ode.Rd create mode 100644 man/compute_NI_default.Rd create mode 100644 man/compute_NI_i.Rd create mode 100644 man/compute_fqZ.Rd create mode 100644 man/compute_fqZ.aqua.Rd create mode 100644 man/compute_fqZ.aqua_dde.Rd create mode 100644 man/compute_fqZ.cohort.Rd create mode 100644 man/compute_fqZ.dde.Rd create mode 100644 man/compute_fqZ.human.Rd create mode 100644 man/compute_fqZ.mosy.Rd create mode 100644 man/compute_fqZ.mosy_dde.Rd create mode 100644 man/compute_fqZ.ode.Rd create mode 100644 man/compute_fqZ_default.Rd create mode 100644 man/compute_fqZ_i.Rd create mode 100644 man/compute_kappa.Rd create mode 100644 man/compute_kappa.aqua.Rd create mode 100644 man/compute_kappa.aqua_dde.Rd create mode 100644 man/compute_kappa.cohort.Rd create mode 100644 man/compute_kappa.dde.Rd create mode 100644 man/compute_kappa.human.Rd create mode 100644 man/compute_kappa.mosy.Rd create mode 100644 man/compute_kappa.mosy_dde.Rd create mode 100644 man/compute_kappa.ode.Rd create mode 100644 man/compute_kappa_default.Rd create mode 100644 man/compute_kappa_i.Rd diff --git a/NAMESPACE b/NAMESPACE index 0697b33c..a9c18d04 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -109,6 +109,38 @@ S3method(check_abiotic,forced) S3method(check_abiotic,null) S3method(check_civil,forced) S3method(check_civil,null) +S3method(compute_EIR,aqua) +S3method(compute_EIR,aqua_dde) +S3method(compute_EIR,cohort) +S3method(compute_EIR,dde) +S3method(compute_EIR,human) +S3method(compute_EIR,mosy) +S3method(compute_EIR,mosy_dde) +S3method(compute_EIR,ode) +S3method(compute_NI,aqua) +S3method(compute_NI,aqua_dde) +S3method(compute_NI,cohort) +S3method(compute_NI,dde) +S3method(compute_NI,human) +S3method(compute_NI,mosy) +S3method(compute_NI,mosy_dde) +S3method(compute_NI,ode) +S3method(compute_fqZ,aqua) +S3method(compute_fqZ,aqua_dde) +S3method(compute_fqZ,cohort) +S3method(compute_fqZ,dde) +S3method(compute_fqZ,human) +S3method(compute_fqZ,mosy) +S3method(compute_fqZ,mosy_dde) +S3method(compute_fqZ,ode) +S3method(compute_kappa,aqua) +S3method(compute_kappa,aqua_dde) +S3method(compute_kappa,cohort) +S3method(compute_kappa,dde) +S3method(compute_kappa,human) +S3method(compute_kappa,mosy) +S3method(compute_kappa,mosy_dde) +S3method(compute_kappa,ode) S3method(dHdt,numeric) S3method(dHdt,static) S3method(dLdt,basic) @@ -283,7 +315,19 @@ export(approx_equal) export(checkIt) export(check_abiotic) export(check_civil) +export(compute_EIR) +export(compute_EIR_default) +export(compute_EIR_i) +export(compute_NI) +export(compute_NI_default) +export(compute_NI_i) export(compute_beta) +export(compute_fqZ) +export(compute_fqZ_default) +export(compute_fqZ_i) +export(compute_kappa) +export(compute_kappa_default) +export(compute_kappa_i) export(compute_local_frac) export(dHdt) export(dLdt) diff --git a/R/aquatic-basic.R b/R/aquatic-basic.R index fe12f4ef..b2746d9a 100644 --- a/R/aquatic-basic.R +++ b/R/aquatic-basic.R @@ -113,7 +113,7 @@ make_indices_L.basic <- function(pars) { #' @return varslist a [list] #' @export parse_deout_L.basic <- function(varslist, deout, pars) { - varslist$L = deout[,pars$Lpar$Lix+1] + varslist$L = deout[,pars$Lpar$L_ix+1] return(varslist) } diff --git a/R/compute.R b/R/compute.R new file mode 100644 index 00000000..13f587bb --- /dev/null +++ b/R/compute.R @@ -0,0 +1,448 @@ +#' @title Compute the EIR +#' @description Using the output of deSolve, +#' compute the EIR at every point in time +#' @param deout a [matrix], the output of deSolve +#' @param pars a [list] +#' @return [matrix] +#' @export +compute_EIR <- function(deout, pars) { + UseMethod("compute_EIR", pars$xde) +} + +#' @title Compute the EIR +#' @description Using the output of deSolve, +#' compute the EIR at every point in time +#' @param deout a [matrix], the output of deSolve +#' @param pars a [list] +#' @return [matrix] +#' @export +compute_EIR_default <- function(deout, pars) { + ix = 1:length(deout[,1]) + eir = sapply(ix, compute_EIR_i, deout=deout, pars=pars) + return(eir) +} + +#' @title Compute the EIR for the ith point in time +#' @description Using the output of deSolve, +#' compute the EIR at one point in time +#' @param i an [integer] +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [numeric] +#' @export +compute_EIR_i <- function(i, deout, pars) { + t = deout[i,1] + y = deout[i,-1] + beta <- F_beta(t, y, pars) + eir = F_EIR(t, y, pars, beta) + return(eir) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for the full DDEs +#' @inheritParams compute_EIR +#' @return a [matrix] +#' @export +compute_EIR.dde <- function(deout, pars) { + compute_EIR_default(deout, pars) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for the full ODEs +#' @inheritParams compute_EIR +#' @return a [matrix] +#' @export +compute_EIR.ode <- function(deout, pars) { + compute_EIR_default(deout, pars) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for aquatic ODEs +#' @inheritParams compute_EIR +#' @return a [matrix] +#' @export +compute_EIR.aqua <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for aquatic DDEs +#' @inheritParams compute_EIR +#' @return a [vector] +#' @export +compute_EIR.aqua_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for mosquito ODEs +#' @inheritParams compute_EIR +#' @return a [vector] +#' @export +compute_EIR.mosy <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for mosquito DDEs +#' @inheritParams compute_EIR +#' @return a [vector] +#' @export +compute_EIR.mosy_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for human ODEs +#' @inheritParams compute_EIR +#' @return a [vector] +#' @export +compute_EIR.human<- function(deout, pars) { + compute_EIR_default(deout, pars) +} + +#' @title Compute the EIR +#' @description Implements [compute_EIR] for cohort ODEs +#' @inheritParams compute_EIR +#' @return a [vector] +#' @export +compute_EIR.cohort<- function(deout, pars) { + t = deout[,1] + eir = pars$F_eir(t, pars) +} + +#' @title Compute the fqZ +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the fqZ at every point in time +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [vector] +#' @export +compute_fqZ <- function(deout, pars) { + UseMethod("compute_fqZ", pars$xde) +} + +#' @title Compute the fqZ +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the fqZ at every point in time +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [vector] +#' @export +compute_fqZ_default <- function(deout, pars) { + ix = 1:length(deout[,1]) + fqZ = sapply(ix, compute_fqZ_i, deout=deout, pars=pars) + return(fqZ) +} + +#' @title Compute the fqZ for the ith +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the fqZ at one point in time +#' @param i an [integer] +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [numeric] +#' @export +compute_fqZ_i <- function(i, deout, pars) { + t = deout[i,1] + y = deout[i,-1] + fqZ = F_fqZ(t, y, pars) + return(fqZ) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=dde +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.dde <- function(deout, pars) { + compute_fqZ_default(deout, pars) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=ode +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.ode <- function(deout, pars) { + compute_fqZ_default(deout, pars) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=aqua +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.aqua <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=aqua_dde +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.aqua_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=mosy +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.mosy <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=mosy_dde +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.mosy_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=human +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.human<- function(deout, pars) { + compute_fqZ_default(deout, pars) +} + +#' @title Compute the fqZ +#' @description Implements [compute_fqZ] for class(pars$xde)=cohort +#' @inheritParams compute_fqZ +#' @return a [vector] +#' @export +compute_fqZ.cohort<- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the NI +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the NI for each stratum +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [numeric] containing the NI +#' @export +compute_NI <- function(deout, pars) { + UseMethod("compute_NI", pars$xde) +} + +#' @title Compute the NI +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the NI for each stratum +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [numeric] containing the NI +#' @export +compute_NI_default <- function(deout, pars) { + ix = 1:length(deout[,1]) + NI = sapply(ix, compute_NI_i, deout=deout, pars=pars) + return(t(NI)) +} + +#' @title Compute NI once +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the NI at a point in time +#' @param i an [integer] +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return a [list] containing the NI +#' @export +compute_NI_i <- function(i, deout, pars) { + t = deout[i,1] + y = deout[i,-1] + X <- F_X(t, y, pars) + H = F_H(t, y, pars) + NI = X/H + return(NI) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=ode +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.ode <- function(deout, pars) { + compute_NI_default(deout, pars) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=dde +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.dde <- function(deout, pars) { + compute_NI_default(deout, pars) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=aqua +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.aqua <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=aqua_dde +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.aqua_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=mosy +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.mosy <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=mosy_dde +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.mosy_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=human +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.human<- function(deout, pars) { + compute_NI_default(deout, pars) +} + +#' @title Compute the NI +#' @description Implements [compute_NI] for class(pars$xde)=cohort +#' @inheritParams compute_NI +#' @return a [vector] +#' @export +compute_NI.cohort<- function(deout, pars) { + compute_NI_default(deout, pars) +} + +#' @title Compute kappa +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the kappa for each stratum +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [numeric] containing the kappa +#' @export +compute_kappa <- function(deout, pars) { + UseMethod("compute_kappa", pars$xde) +} + +#' @title Compute the kappa +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the kappa for each stratum +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return [numeric] containing the kappa +#' @export +compute_kappa_default <- function(deout, pars) { + ix = 1:length(deout[,1]) + kappa = sapply(ix, compute_kappa_i, deout=deout, pars=pars) + return(t(kappa)) +} + +#' @title Compute kappa once +#' @description Using the output of [deSolve::ode] or [deSolve::dede], +#' compute the kappa at a point in time +#' @param i an [integer] +#' @param deout a matrix, the output of deSolve +#' @param pars a [list] +#' @return a [list] containing the kappa +#' @export +compute_kappa_i <- function(i, deout, pars) { + t = deout[i,1] + y = deout[i,-1] + beta <- F_beta(t, y, pars) + kappa = F_kappa(t, y, pars, beta) + return(kappa) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=dde +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.dde <- function(deout, pars) { + compute_kappa_default(deout, pars) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=ode +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.ode <- function(deout, pars) { + compute_kappa_default(deout, pars) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=aqua +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.aqua <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=aqua_dde +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.aqua_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=mosy +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.mosy <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=mosy_dde +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.mosy_dde <- function(deout, pars) { + return(numeric(0)) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=human +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.human<- function(deout, pars) { + compute_kappa_default(deout, pars) +} + +#' @title Compute the kappa +#' @description Implements [compute_kappa] for class(pars$xde)=cohort +#' @inheritParams compute_kappa +#' @return a [vector] +#' @export +compute_kappa.cohort<- function(deout, pars) { + return(numeric(0)) +} diff --git a/R/diffeqn.R b/R/diffeqn.R index 75136932..67d58bc4 100644 --- a/R/diffeqn.R +++ b/R/diffeqn.R @@ -51,12 +51,7 @@ xDE_diffeqn <- function(t, y, pars) { dMYZ <- dMYZdt(t, y, pars, Lambda, kappa) dX <- dXdt(t, y, pars, FoI) - if(pars$eir_out==TRUE) {EIRt = EIR}else{EIRt = numeric(0)} - if(pars$fqZ_out==TRUE) {fqZt = F_fqZ(t, y, pars)}else{fqZt = numeric(0)} - if(pars$NI_out==TRUE) {NIt = F_X(t, y, pars)/F_H(t, y, pars)}else{NIt = numeric(0)} - if(pars$kappa_out==TRUE) {kappat = kappa}else{kappat = numeric(0)} - - return(list(c(dL, dMYZ, dX, EIRt, fqZt, NIt, kappat))) + return(list(c(dL, dMYZ, dX))) } #' @title Differential equations isolating the humans, forced with Ztrace @@ -93,12 +88,7 @@ xDE_diffeqn_human <- function(t, y, pars) { # state derivatives dX <- dXdt(t, y, pars, FoI) - if(pars$eir_out==TRUE) {EIRt = EIR}else{EIRt = numeric(0)} - if(pars$fqZ_out==TRUE) {fqZt = F_fqZ(t, y, pars)}else{fqZt = numeric(0)} - if(pars$NI_out==TRUE) {NIt = as.numeric(F_X(t, y, pars)/F_H(t, y, pars))}else{NIt = numeric(0)} - if(pars$kappa_out==TRUE) {kappat <- F_kappa(t, y, pars, beta)}else{kappat = numeric(0)} - - return(list(c(dX, EIRt, fqZt, NIt, kappat))) + return(list(c(dX))) } @@ -162,10 +152,7 @@ xDE_diffeqn_cohort <- function(a, y, pars, F_eir) { # state derivatives dX <- dXdt(a, y, pars, FoI) - if(pars$eir_out==TRUE) {EIRt = EIR}else{EIRt = numeric(0)} - if(pars$NI_out==TRUE) {NIt = F_X(a, y, pars)/F_H(a, y, pars)}else{NIt = numeric(0)} - - return(list(c(dX, EIRt, NIt))) + return(list(c(dX))) } #' @title Differential equation models for aquatic mosquito populations diff --git a/R/setup.R b/R/setup.R index ba51e87b..78e8eb02 100644 --- a/R/setup.R +++ b/R/setup.R @@ -19,10 +19,6 @@ #' @param TaRopts are the options to setup TaR #' @param searchQ is a vector of search weights for egg laying #' @param Lopts a list to configure the L model -#' @param eir_out the cumulative eir is output if TRUE -#' @param fqZ_out the cumulative fqZ is output if TRUE -#' @param NI_out the cumulative NI is output if TRUE -#' @param kappa_out the cumulative kappa is output if TRUE #' @return a [list] #' @export xde_setup = function(modelName, @@ -52,12 +48,7 @@ xde_setup = function(modelName, # Aquatic Mosquito Options searchQ = 1, - Lopts = list(), - - eir_out = TRUE, - fqZ_out = FALSE, - NI_out = FALSE, - kappa_out = TRUE + Lopts = list() ){ @@ -78,11 +69,6 @@ xde_setup = function(modelName, pars = setup_L(pars, Lname, membership, searchQ, Lopts) pars = setup_X(pars, Xname, Xopts) - pars$eir_out = eir_out - pars$fqZ_out = fqZ_out - pars$NI_out = NI_out - pars$kappa_out = kappa_out - pars = make_indices(pars) return(pars) @@ -193,10 +179,6 @@ xde_setup_aquatic = function(modelName, #' @param searchB is a vector of search weights for blood feeding #' @param TaR is either a TaR matrix or a string to call a function that sets it up #' @param TaRopts are the options to setup TaR -#' @param eir_out the cumulative eir is output if TRUE -#' @param fqZ_out the cumulative fqZ is output if TRUE -#' @param NI_out the cumulative NI is output if TRUE -#' @param kappa_out the cumulative kappa is output if TRUE #' @return a [list] #' @export xde_setup_human = function(modelName, @@ -216,12 +198,7 @@ xde_setup_human = function(modelName, residence=1, searchB = 1, TaR = "athome", - TaRopts=list(), - - eir_out = TRUE, - fqZ_out = FALSE, - NI_out = FALSE, - kappa_out = TRUE + TaRopts=list() ){ @@ -243,11 +220,6 @@ xde_setup_human = function(modelName, pars = make_indices(pars) - pars$eir_out = eir_out - pars$fqZ_out = fqZ_out - pars$NI_out = NI_out - pars$kappa_out = kappa_out - return(pars) } @@ -258,8 +230,6 @@ xde_setup_human = function(modelName, #' @param HPop is the number of humans in each patch #' @param Xopts a list to configure the X model #' @param Hopts a list to configure the H model -#' @param eir_out the cumulative eir is output if TRUE -#' @param NI_out the cumulative NI is output if TRUE #' @return a [list] #' @export xde_setup_cohort = function(modelName, F_eir, @@ -272,11 +242,7 @@ xde_setup_cohort = function(modelName, F_eir, # Human Strata / Options Xopts = list(), - Hopts = list(), - - eir_out = TRUE, - NI_out = TRUE - + Hopts = list() ){ @@ -295,9 +261,6 @@ xde_setup_cohort = function(modelName, F_eir, # Dynamics pars = setup_X(pars, Xname, Xopts) - pars$eir_out = eir_out - pars$NI_out = NI_out - pars = make_indices(pars) return(pars) diff --git a/R/utils.R b/R/utils.R index 32f15b4c..b16d5633 100644 --- a/R/utils.R +++ b/R/utils.R @@ -47,22 +47,6 @@ make_indices <- function(pars) { if ('Hpar' %in% names(pars)) { pars = make_indices_H(pars) } - if(pars$eir_out == TRUE){ - pars$eir_ix <- seq(from = pars$max_ix+1, length.out = pars$nStrata) - pars$max_ix <- tail(pars$eir_ix, 1) - } - if(pars$fqZ_out == TRUE){ - pars$fqZ_ix <- seq(from = pars$max_ix+1, length.out = pars$nPatches) - pars$max_ix <- tail(pars$fqZ_ix, 1) - } - if(pars$NI_out == TRUE){ - pars$NI_ix <- seq(from = pars$max_ix+1, length.out = pars$nStrata) - pars$max_ix <- tail(pars$NI_ix, 1) - } - if(pars$kappa_out == TRUE){ - pars$kappa_ix <- seq(from = pars$max_ix+1, length.out = pars$nPatches) - pars$max_ix <- tail(pars$kappa_ix, 1) - } return(pars) } @@ -107,8 +91,6 @@ get_inits <- function(pars){ parse_deout <- function(deout, pars){ varslist = list() varslist$deout = deout - varslist$time = deout[,1] - dtime = diff(deout[,1]) if ('Lpar' %in% names(pars)) { varslist = parse_deout_L(varslist, deout, pars) } @@ -121,42 +103,10 @@ parse_deout <- function(deout, pars){ if ('Xpar' %in% names(pars)) { varslist = parse_deout_X(varslist, deout, pars) } - if (pars$eir_out == TRUE) { - cum_eir = deout[,1+pars$eir_ix] - if(pars$nStrata>1){ - varslist$eir=apply(cum_eir, 2, diff)/dtime - } else { - eir = diff(cum_eir)/dtime - varslist$eir= c(eir, eir[1]) - } - } - if (pars$fqZ_out == TRUE) { - cum_fqZ = deout[,1+pars$fqZ_ix] - if(pars$nPatches>1){ - varslist$fqZ=apply(cum_fqZ, 2, diff)/dtime - } else { - fqZ= diff(cum_fqZ)/dtime - varslist$fqZ = c(fqZ, fqZ[1]) - } - } - if (pars$NI_out == TRUE) { - cum_ni = deout[,1+pars$NI_ix] - if(pars$nStrata>1){ - varslist$ni=apply(cum_ni, 2, diff)/dtime - } else { - ni= diff(cum_ni)/dtime - varslist$ni = c(ni, ni[1]) - } - } - if (pars$kappa_out == TRUE) { - cum_kappa = deout[,1+pars$kappa_ix] - if(pars$nPatches>1){ - varslist$kappa=apply(cum_kappa, 2, diff)/dtime - } else { - kappa = diff(cum_kappa)/dtime - varslist$kappa = c(kappa, kappa[1]) - } - } + varslist$eir = compute_EIR(deout, pars) + varslist$fqZ = compute_fqZ(deout, pars) + varslist$NI = compute_NI(deout, pars) + varslist$kappa = compute_kappa(deout, pars) return(varslist) } diff --git a/_pkgdown.yml b/_pkgdown.yml index ac02be8a..c2263081 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -705,3 +705,49 @@ reference: - diag_inverse - approx_equal - checkIt +- title: Compute terms + contents: + - compute_EIR + - compute_EIR_default + - compute_EIR_i + - compute_EIR.dde + - compute_EIR.ode + - compute_EIR.aqua + - compute_EIR.aqua_dde + - compute_EIR.mosy + - compute_EIR.mosy_dde + - compute_EIR.human + - compute_EIR.cohort + - compute_fqZ + - compute_fqZ_default + - compute_fqZ_i + - compute_fqZ.dde + - compute_fqZ.ode + - compute_fqZ.aqua + - compute_fqZ.aqua_dde + - compute_fqZ.mosy + - compute_fqZ.mosy_dde + - compute_fqZ.human + - compute_fqZ.cohort + - compute_NI + - compute_NI_default + - compute_NI_i + - compute_NI.dde + - compute_NI.ode + - compute_NI.aqua + - compute_NI.aqua_dde + - compute_NI.mosy + - compute_NI.mosy_dde + - compute_NI.human + - compute_NI.cohort + - compute_kappa + - compute_kappa_default + - compute_kappa_i + - compute_kappa.dde + - compute_kappa.ode + - compute_kappa.aqua + - compute_kappa.aqua_dde + - compute_kappa.mosy + - compute_kappa.mosy_dde + - compute_kappa.human + - compute_kappa.cohort diff --git a/man/compute_EIR.Rd b/man/compute_EIR.Rd new file mode 100644 index 00000000..046e235e --- /dev/null +++ b/man/compute_EIR.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR} +\alias{compute_EIR} +\title{Compute the EIR} +\usage{ +compute_EIR(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{matrix} +} +\description{ +Using the output of deSolve, +compute the EIR at every point in time +} diff --git a/man/compute_EIR.aqua.Rd b/man/compute_EIR.aqua.Rd new file mode 100644 index 00000000..6c7a5a4c --- /dev/null +++ b/man/compute_EIR.aqua.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.aqua} +\alias{compute_EIR.aqua} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{aqua}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{matrix} +} +\description{ +Implements \link{compute_EIR} for aquatic ODEs +} diff --git a/man/compute_EIR.aqua_dde.Rd b/man/compute_EIR.aqua_dde.Rd new file mode 100644 index 00000000..c04ecad8 --- /dev/null +++ b/man/compute_EIR.aqua_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.aqua_dde} +\alias{compute_EIR.aqua_dde} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{aqua_dde}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_EIR} for aquatic DDEs +} diff --git a/man/compute_EIR.cohort.Rd b/man/compute_EIR.cohort.Rd new file mode 100644 index 00000000..e0f7fa5b --- /dev/null +++ b/man/compute_EIR.cohort.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.cohort} +\alias{compute_EIR.cohort} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{cohort}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_EIR} for cohort ODEs +} diff --git a/man/compute_EIR.dde.Rd b/man/compute_EIR.dde.Rd new file mode 100644 index 00000000..a0736f36 --- /dev/null +++ b/man/compute_EIR.dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.dde} +\alias{compute_EIR.dde} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{dde}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{matrix} +} +\description{ +Implements \link{compute_EIR} for the full DDEs +} diff --git a/man/compute_EIR.human.Rd b/man/compute_EIR.human.Rd new file mode 100644 index 00000000..780886e3 --- /dev/null +++ b/man/compute_EIR.human.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.human} +\alias{compute_EIR.human} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{human}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_EIR} for human ODEs +} diff --git a/man/compute_EIR.mosy.Rd b/man/compute_EIR.mosy.Rd new file mode 100644 index 00000000..ed9b8570 --- /dev/null +++ b/man/compute_EIR.mosy.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.mosy} +\alias{compute_EIR.mosy} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{mosy}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_EIR} for mosquito ODEs +} diff --git a/man/compute_EIR.mosy_dde.Rd b/man/compute_EIR.mosy_dde.Rd new file mode 100644 index 00000000..a14d74a3 --- /dev/null +++ b/man/compute_EIR.mosy_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.mosy_dde} +\alias{compute_EIR.mosy_dde} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{mosy_dde}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_EIR} for mosquito DDEs +} diff --git a/man/compute_EIR.ode.Rd b/man/compute_EIR.ode.Rd new file mode 100644 index 00000000..a0b9f64e --- /dev/null +++ b/man/compute_EIR.ode.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR.ode} +\alias{compute_EIR.ode} +\title{Compute the EIR} +\usage{ +\method{compute_EIR}{ode}(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{matrix} +} +\description{ +Implements \link{compute_EIR} for the full ODEs +} diff --git a/man/compute_EIR_default.Rd b/man/compute_EIR_default.Rd new file mode 100644 index 00000000..199773cf --- /dev/null +++ b/man/compute_EIR_default.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR_default} +\alias{compute_EIR_default} +\title{Compute the EIR} +\usage{ +compute_EIR_default(deout, pars) +} +\arguments{ +\item{deout}{a \link{matrix}, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{matrix} +} +\description{ +Using the output of deSolve, +compute the EIR at every point in time +} diff --git a/man/compute_EIR_i.Rd b/man/compute_EIR_i.Rd new file mode 100644 index 00000000..107a17a1 --- /dev/null +++ b/man/compute_EIR_i.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_EIR_i} +\alias{compute_EIR_i} +\title{Compute the EIR for the ith point in time} +\usage{ +compute_EIR_i(i, deout, pars) +} +\arguments{ +\item{i}{an \link{integer}} + +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{numeric} +} +\description{ +Using the output of deSolve, +compute the EIR at one point in time +} diff --git a/man/compute_NI.Rd b/man/compute_NI.Rd new file mode 100644 index 00000000..3aae396c --- /dev/null +++ b/man/compute_NI.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI} +\alias{compute_NI} +\title{Compute the NI} +\usage{ +compute_NI(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{numeric} containing the NI +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the NI for each stratum +} diff --git a/man/compute_NI.aqua.Rd b/man/compute_NI.aqua.Rd new file mode 100644 index 00000000..cfb54c53 --- /dev/null +++ b/man/compute_NI.aqua.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.aqua} +\alias{compute_NI.aqua} +\title{Compute the NI} +\usage{ +\method{compute_NI}{aqua}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=aqua +} diff --git a/man/compute_NI.aqua_dde.Rd b/man/compute_NI.aqua_dde.Rd new file mode 100644 index 00000000..6e84e172 --- /dev/null +++ b/man/compute_NI.aqua_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.aqua_dde} +\alias{compute_NI.aqua_dde} +\title{Compute the NI} +\usage{ +\method{compute_NI}{aqua_dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=aqua_dde +} diff --git a/man/compute_NI.cohort.Rd b/man/compute_NI.cohort.Rd new file mode 100644 index 00000000..7b56d13a --- /dev/null +++ b/man/compute_NI.cohort.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.cohort} +\alias{compute_NI.cohort} +\title{Compute the NI} +\usage{ +\method{compute_NI}{cohort}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=cohort +} diff --git a/man/compute_NI.dde.Rd b/man/compute_NI.dde.Rd new file mode 100644 index 00000000..cc0c5616 --- /dev/null +++ b/man/compute_NI.dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.dde} +\alias{compute_NI.dde} +\title{Compute the NI} +\usage{ +\method{compute_NI}{dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=dde +} diff --git a/man/compute_NI.human.Rd b/man/compute_NI.human.Rd new file mode 100644 index 00000000..ac21f5da --- /dev/null +++ b/man/compute_NI.human.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.human} +\alias{compute_NI.human} +\title{Compute the NI} +\usage{ +\method{compute_NI}{human}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=human +} diff --git a/man/compute_NI.mosy.Rd b/man/compute_NI.mosy.Rd new file mode 100644 index 00000000..35b219aa --- /dev/null +++ b/man/compute_NI.mosy.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.mosy} +\alias{compute_NI.mosy} +\title{Compute the NI} +\usage{ +\method{compute_NI}{mosy}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=mosy +} diff --git a/man/compute_NI.mosy_dde.Rd b/man/compute_NI.mosy_dde.Rd new file mode 100644 index 00000000..e88b745b --- /dev/null +++ b/man/compute_NI.mosy_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.mosy_dde} +\alias{compute_NI.mosy_dde} +\title{Compute the NI} +\usage{ +\method{compute_NI}{mosy_dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=mosy_dde +} diff --git a/man/compute_NI.ode.Rd b/man/compute_NI.ode.Rd new file mode 100644 index 00000000..da1e6c30 --- /dev/null +++ b/man/compute_NI.ode.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI.ode} +\alias{compute_NI.ode} +\title{Compute the NI} +\usage{ +\method{compute_NI}{ode}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_NI} for class(pars$xde)=ode +} diff --git a/man/compute_NI_default.Rd b/man/compute_NI_default.Rd new file mode 100644 index 00000000..57db8af6 --- /dev/null +++ b/man/compute_NI_default.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI_default} +\alias{compute_NI_default} +\title{Compute the NI} +\usage{ +compute_NI_default(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{numeric} containing the NI +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the NI for each stratum +} diff --git a/man/compute_NI_i.Rd b/man/compute_NI_i.Rd new file mode 100644 index 00000000..4aeb6bdb --- /dev/null +++ b/man/compute_NI_i.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_NI_i} +\alias{compute_NI_i} +\title{Compute NI once} +\usage{ +compute_NI_i(i, deout, pars) +} +\arguments{ +\item{i}{an \link{integer}} + +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{list} containing the NI +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the NI at a point in time +} diff --git a/man/compute_fqZ.Rd b/man/compute_fqZ.Rd new file mode 100644 index 00000000..6eab8f9d --- /dev/null +++ b/man/compute_fqZ.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ} +\alias{compute_fqZ} +\title{Compute the fqZ} +\usage{ +compute_fqZ(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{vector} +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the fqZ at every point in time +} diff --git a/man/compute_fqZ.aqua.Rd b/man/compute_fqZ.aqua.Rd new file mode 100644 index 00000000..03bdfe1b --- /dev/null +++ b/man/compute_fqZ.aqua.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.aqua} +\alias{compute_fqZ.aqua} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{aqua}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=aqua +} diff --git a/man/compute_fqZ.aqua_dde.Rd b/man/compute_fqZ.aqua_dde.Rd new file mode 100644 index 00000000..f6409c44 --- /dev/null +++ b/man/compute_fqZ.aqua_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.aqua_dde} +\alias{compute_fqZ.aqua_dde} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{aqua_dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=aqua_dde +} diff --git a/man/compute_fqZ.cohort.Rd b/man/compute_fqZ.cohort.Rd new file mode 100644 index 00000000..9f9be95f --- /dev/null +++ b/man/compute_fqZ.cohort.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.cohort} +\alias{compute_fqZ.cohort} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{cohort}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=cohort +} diff --git a/man/compute_fqZ.dde.Rd b/man/compute_fqZ.dde.Rd new file mode 100644 index 00000000..9918ecef --- /dev/null +++ b/man/compute_fqZ.dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.dde} +\alias{compute_fqZ.dde} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=dde +} diff --git a/man/compute_fqZ.human.Rd b/man/compute_fqZ.human.Rd new file mode 100644 index 00000000..69871ffe --- /dev/null +++ b/man/compute_fqZ.human.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.human} +\alias{compute_fqZ.human} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{human}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=human +} diff --git a/man/compute_fqZ.mosy.Rd b/man/compute_fqZ.mosy.Rd new file mode 100644 index 00000000..ebba5945 --- /dev/null +++ b/man/compute_fqZ.mosy.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.mosy} +\alias{compute_fqZ.mosy} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{mosy}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=mosy +} diff --git a/man/compute_fqZ.mosy_dde.Rd b/man/compute_fqZ.mosy_dde.Rd new file mode 100644 index 00000000..b46d0d9e --- /dev/null +++ b/man/compute_fqZ.mosy_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.mosy_dde} +\alias{compute_fqZ.mosy_dde} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{mosy_dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=mosy_dde +} diff --git a/man/compute_fqZ.ode.Rd b/man/compute_fqZ.ode.Rd new file mode 100644 index 00000000..148e6cf4 --- /dev/null +++ b/man/compute_fqZ.ode.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ.ode} +\alias{compute_fqZ.ode} +\title{Compute the fqZ} +\usage{ +\method{compute_fqZ}{ode}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_fqZ} for class(pars$xde)=ode +} diff --git a/man/compute_fqZ_default.Rd b/man/compute_fqZ_default.Rd new file mode 100644 index 00000000..1a9860f9 --- /dev/null +++ b/man/compute_fqZ_default.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ_default} +\alias{compute_fqZ_default} +\title{Compute the fqZ} +\usage{ +compute_fqZ_default(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{vector} +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the fqZ at every point in time +} diff --git a/man/compute_fqZ_i.Rd b/man/compute_fqZ_i.Rd new file mode 100644 index 00000000..6761f5dd --- /dev/null +++ b/man/compute_fqZ_i.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_fqZ_i} +\alias{compute_fqZ_i} +\title{Compute the fqZ for the ith} +\usage{ +compute_fqZ_i(i, deout, pars) +} +\arguments{ +\item{i}{an \link{integer}} + +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{numeric} +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the fqZ at one point in time +} diff --git a/man/compute_kappa.Rd b/man/compute_kappa.Rd new file mode 100644 index 00000000..ee947ad8 --- /dev/null +++ b/man/compute_kappa.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa} +\alias{compute_kappa} +\title{Compute kappa} +\usage{ +compute_kappa(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{numeric} containing the kappa +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the kappa for each stratum +} diff --git a/man/compute_kappa.aqua.Rd b/man/compute_kappa.aqua.Rd new file mode 100644 index 00000000..2eed6d2e --- /dev/null +++ b/man/compute_kappa.aqua.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.aqua} +\alias{compute_kappa.aqua} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{aqua}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=aqua +} diff --git a/man/compute_kappa.aqua_dde.Rd b/man/compute_kappa.aqua_dde.Rd new file mode 100644 index 00000000..cf408ff4 --- /dev/null +++ b/man/compute_kappa.aqua_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.aqua_dde} +\alias{compute_kappa.aqua_dde} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{aqua_dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=aqua_dde +} diff --git a/man/compute_kappa.cohort.Rd b/man/compute_kappa.cohort.Rd new file mode 100644 index 00000000..cf367331 --- /dev/null +++ b/man/compute_kappa.cohort.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.cohort} +\alias{compute_kappa.cohort} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{cohort}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=cohort +} diff --git a/man/compute_kappa.dde.Rd b/man/compute_kappa.dde.Rd new file mode 100644 index 00000000..d42c0ff0 --- /dev/null +++ b/man/compute_kappa.dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.dde} +\alias{compute_kappa.dde} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=dde +} diff --git a/man/compute_kappa.human.Rd b/man/compute_kappa.human.Rd new file mode 100644 index 00000000..aeacc3d3 --- /dev/null +++ b/man/compute_kappa.human.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.human} +\alias{compute_kappa.human} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{human}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=human +} diff --git a/man/compute_kappa.mosy.Rd b/man/compute_kappa.mosy.Rd new file mode 100644 index 00000000..e2b36bc8 --- /dev/null +++ b/man/compute_kappa.mosy.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.mosy} +\alias{compute_kappa.mosy} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{mosy}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=mosy +} diff --git a/man/compute_kappa.mosy_dde.Rd b/man/compute_kappa.mosy_dde.Rd new file mode 100644 index 00000000..641a9033 --- /dev/null +++ b/man/compute_kappa.mosy_dde.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.mosy_dde} +\alias{compute_kappa.mosy_dde} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{mosy_dde}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=mosy_dde +} diff --git a/man/compute_kappa.ode.Rd b/man/compute_kappa.ode.Rd new file mode 100644 index 00000000..42cd1b91 --- /dev/null +++ b/man/compute_kappa.ode.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa.ode} +\alias{compute_kappa.ode} +\title{Compute the kappa} +\usage{ +\method{compute_kappa}{ode}(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{vector} +} +\description{ +Implements \link{compute_kappa} for class(pars$xde)=ode +} diff --git a/man/compute_kappa_default.Rd b/man/compute_kappa_default.Rd new file mode 100644 index 00000000..56d85cfb --- /dev/null +++ b/man/compute_kappa_default.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa_default} +\alias{compute_kappa_default} +\title{Compute the kappa} +\usage{ +compute_kappa_default(deout, pars) +} +\arguments{ +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +\link{numeric} containing the kappa +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the kappa for each stratum +} diff --git a/man/compute_kappa_i.Rd b/man/compute_kappa_i.Rd new file mode 100644 index 00000000..ec177db4 --- /dev/null +++ b/man/compute_kappa_i.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/compute.R +\name{compute_kappa_i} +\alias{compute_kappa_i} +\title{Compute kappa once} +\usage{ +compute_kappa_i(i, deout, pars) +} +\arguments{ +\item{i}{an \link{integer}} + +\item{deout}{a matrix, the output of deSolve} + +\item{pars}{a \link{list}} +} +\value{ +a \link{list} containing the kappa +} +\description{ +Using the output of \link[deSolve:ode]{deSolve::ode} or \link[deSolve:dede]{deSolve::dede}, +compute the kappa at a point in time +} diff --git a/man/xde_setup.Rd b/man/xde_setup.Rd index f1dac262..bc6537af 100644 --- a/man/xde_setup.Rd +++ b/man/xde_setup.Rd @@ -22,11 +22,7 @@ xde_setup( TaR = "athome", TaRopts = list(), searchQ = 1, - Lopts = list(), - eir_out = TRUE, - fqZ_out = FALSE, - NI_out = FALSE, - kappa_out = TRUE + Lopts = list() ) } \arguments{ @@ -65,14 +61,6 @@ xde_setup( \item{searchQ}{is a vector of search weights for egg laying} \item{Lopts}{a list to configure the L model} - -\item{eir_out}{the cumulative eir is output if TRUE} - -\item{fqZ_out}{the cumulative fqZ is output if TRUE} - -\item{NI_out}{the cumulative NI is output if TRUE} - -\item{kappa_out}{the cumulative kappa is output if TRUE} } \value{ a \link{list} diff --git a/man/xde_setup_cohort.Rd b/man/xde_setup_cohort.Rd index ee12aeec..f8d6d880 100644 --- a/man/xde_setup_cohort.Rd +++ b/man/xde_setup_cohort.Rd @@ -10,9 +10,7 @@ xde_setup_cohort( Xname = "SIS", HPop = 1000, Xopts = list(), - Hopts = list(), - eir_out = TRUE, - NI_out = TRUE + Hopts = list() ) } \arguments{ @@ -27,10 +25,6 @@ xde_setup_cohort( \item{Xopts}{a list to configure the X model} \item{Hopts}{a list to configure the H model} - -\item{eir_out}{the cumulative eir is output if TRUE} - -\item{NI_out}{the cumulative NI is output if TRUE} } \value{ a \link{list} diff --git a/man/xde_setup_human.Rd b/man/xde_setup_human.Rd index 2ab05e40..5261f9a3 100644 --- a/man/xde_setup_human.Rd +++ b/man/xde_setup_human.Rd @@ -14,11 +14,7 @@ xde_setup_human( residence = 1, searchB = 1, TaR = "athome", - TaRopts = list(), - eir_out = TRUE, - fqZ_out = FALSE, - NI_out = FALSE, - kappa_out = TRUE + TaRopts = list() ) } \arguments{ @@ -41,14 +37,6 @@ xde_setup_human( \item{TaR}{is either a TaR matrix or a string to call a function that sets it up} \item{TaRopts}{are the options to setup TaR} - -\item{eir_out}{the cumulative eir is output if TRUE} - -\item{fqZ_out}{the cumulative fqZ is output if TRUE} - -\item{NI_out}{the cumulative NI is output if TRUE} - -\item{kappa_out}{the cumulative kappa is output if TRUE} } \value{ a \link{list} diff --git a/vignettes/adult_RM.Rmd b/vignettes/adult_RM.Rmd index d0609bd5..eb33a295 100644 --- a/vignettes/adult_RM.Rmd +++ b/vignettes/adult_RM.Rmd @@ -163,10 +163,6 @@ params = make_parameters_MYZ_RM(params, nu = nu, eggsPerBatch = eggsPerBatch, eip = eip, solve_as = 'ode') -params$eir_out = FALSE -params$fqZ_out = FALSE -params$NI_out = FALSE -params$kappa_out = FALSE ``` Now we set the values of $\kappa$ and $\Lambda$ and solve for the equilibrium values. @@ -274,7 +270,7 @@ Otherwise, setup takes care of all the internals: xde_setup("MYZeg", MYZname = "RM", Xname = "trace", Lname = "trace", nPatches=3, calK=calK, membership = c(1:3), - MYZopts = MYZo, Xopts = Xo, Lopts = Lo, eir_out=FALSE, fqZ_out=FALSE, NI_out=FALSE, kappa_out=FALSE) -> MYZeg + MYZopts = MYZo, Xopts = Xo, Lopts = Lo) -> MYZeg ``` Now, we can solve the equations using `xde_solve` and compare the output to what we got above. If they are identical, the two objects should be identical, so can simply add the absolute value of their differences: diff --git a/vignettes/ex_534.Rmd b/vignettes/ex_534.Rmd index a8a0b68d..36e281ea 100644 --- a/vignettes/ex_534.Rmd +++ b/vignettes/ex_534.Rmd @@ -222,11 +222,6 @@ params = make_Xinits_SIS(params, X0=X0) After the parameters for `5-3-4` have been specified, we can generate the indices for the model and attach them to the parameter list. ```{r} -params$eir_out = FALSE -params$fqZ_out = FALSE -params$NI_out = FALSE -params$kappa_out = FALSE - params = make_indices(params) ``` @@ -309,8 +304,7 @@ xde_setup("mod534", "RM", "SIS", "basic", membership=c(1,1,1,2,2), MYZopts=MYZo, calK=calK, Xopts=Xo, residence=c(2,2,3,3), searchB=searchWtsH, - TaR=TaR, searchQ = c(7,2,1,8,2), Lopts = Lo, - eir_out=F, fqZ_out=F, NI_out=F, kappa_out = F) -> mod534 + TaR=TaR, searchQ = c(7,2,1,8,2), Lopts = Lo) -> mod534 ``` We solve and take the differences to check: diff --git a/vignettes/human_hmoi.Rmd b/vignettes/human_hmoi.Rmd index bdaba5d3..115e3c7e 100644 --- a/vignettes/human_hmoi.Rmd +++ b/vignettes/human_hmoi.Rmd @@ -106,10 +106,6 @@ params = make_parameters_demography_null(pars = params, H=H, residence=residence params = make_parameters_X_hMoI(pars = params, b = b, c1 = c1, c2 = c2, r1 = r1, r2 = r2) params = make_inits_X_hMoI(pars = params, rep(m10, nStrata), rep(m20, nStrata)) -params$eir_out = FALSE -params$fqZ_out = FALSE -params$NI_out = FALSE -params$kappa_out = FALSE params = make_indices(params) ``` @@ -158,7 +154,7 @@ F_eir1 = fF_eir1(EIR) ``` ```{r} -xde_setup_cohort("test_hMoI", F_eir1, "hMoI", HPop=Hpop, Xopts = Xo, eir_out=F, NI_out=F) ->test_hMoI +xde_setup_cohort("test_hMoI", F_eir1, "hMoI", HPop=Hpop, Xopts = Xo) ->test_hMoI ``` ```{r} diff --git a/vignettes/human_sip.Rmd b/vignettes/human_sip.Rmd index 1b9c14ce..96955608 100644 --- a/vignettes/human_sip.Rmd +++ b/vignettes/human_sip.Rmd @@ -92,10 +92,6 @@ params = make_parameters_demography_null(pars = params, H=H, residence=residence params = make_parameters_X_SIP(pars = params, b = b, c = c, r = r, rho = rho, eta = eta, xi=xi) params = make_inits_X_SIP(pars = params, X, as.vector(P)) -params$eir_out = FALSE -params$fqZ_out = FALSE -params$NI_out = FALSE -params$kappa_out = FALSE params = make_indices(params) ``` @@ -139,7 +135,7 @@ F_eir1 = fF_eir1(EIR) ``` ```{r} -xde_setup_cohort("test_SIP", F_eir1, "SIP", HPop=Hpop, Xopts = Xo, eir_out=F, NI_out=F) -> test_SIP +xde_setup_cohort("test_SIP", F_eir1, "SIP", HPop=Hpop, Xopts = Xo) -> test_SIP ``` ```{r} diff --git a/vignettes/human_sis.Rmd b/vignettes/human_sis.Rmd index cb649832..a424d1e5 100644 --- a/vignettes/human_sis.Rmd +++ b/vignettes/human_sis.Rmd @@ -93,10 +93,6 @@ params = make_parameters_demography_null(pars = params, H=H, residence=residence params = make_parameters_X_SIS(pars = params, b = b, c = c, r = r) params = make_inits_X_SIS(pars = params, X) -params$eir_out = FALSE -params$fqZ_out = FALSE -params$NI_out = FALSE -params$kappa_out = FALSE params = make_indices(params) ``` @@ -138,7 +134,7 @@ F_eir1 = fF_eir1(EIR) ``` ```{r} -xde_setup_cohort("test_SIS", F_eir1, "SIS", HPop=Hpop, Xopts = Xo, eir_out=F, NI_out=F) -> test_SIS +xde_setup_cohort("test_SIS", F_eir1, "SIS", HPop=Hpop, Xopts = Xo) -> test_SIS ``` ```{r}