|
#' @param dIp, a vector of times + probabilities for the duration of this event |
|
#' @param dIs, same |
|
#' @param dIa, same |
|
#' @param mixmatrix, the mixing matrices |
|
#' @param mwweights, their relative weights |
|
#' @param fIs, the relative contribution of Is |
|
#' @param fIp, same |
|
#' @param fIa, same |
|
#' @param uval, vector of susceptibility modifiers, by age |
|
#' @param yval, vector of asymptomatic fractions, by age |
|
#' @param u_multiplier, the multiplier to modify effective susceptibility |
|
#' @param durmultiplier, the relative multiplier to reduce durations of infectiousness |
|
#' |
|
#' @return the eigenvalue of the ODE transmission / transition matrix |
|
ngmR <- function( |
|
dIp = delay_gamma(1.5, 4.0, t_max = 15, t_step = 0.25)$p, |
|
dIs = delay_gamma(3.5, 4.0, t_max = 15, t_step = 0.25)$p, |
|
dIa = delay_gamma(5.0, 4.0, t_max = 15, t_step = 0.25)$p, |
|
mixmatrix, mweights, |
|
fIs = 1, fIp = 1, fIa = 0.5, |
|
uval, yval, |
|
u_multiplier = 1, durmultiplier = 1 |
|
) { |
|
durIp <- mean_dur(dIp, 0.25)*durmultiplier |
|
durIs <- mean_dur(dIs, 0.25)*durmultiplier |
|
durIa <- mean_dur(dIa, 0.25)*durmultiplier |
|
|
|
mixing <- Reduce(`+`, mapply(function(c, m) c*m, mixmatrix, mweights, SIMPLIFY = FALSE)) |
|
ngm = uval * u_multiplier * t(t(mixing) * ( |
|
yval * (fIp * durIp + fIs * durIs) +(1 - yval) * fIa * durIa)) |
|
Re(eigen(ngm)$values[1]) |
|
} |
omicronSA/R/ngm_ratio.R
Lines 59 to 90 in 33d4ecb
The relevant lines to update for eigenvalue / NGM calculations.