infection_probabilities.Rd
Create multinomial distribution for infection probabilities
infection_probabilities(multi_dens, params)
multi_dens | Matrix where each row gives the probability density of each infection type for a given multiplicity of infection. |
---|---|
params | Parameter vector. Must contain at least one value named `mu`, which is the mean muliplicity of infection. Could also contain `size` in which case negative binomial distribution is used. See details. |
Returns a named multinomial probability distribution.
Using either a poisson or negative binomial distribution, the probability of drawing `1:nrow(multi_dens)` for the parmeters provided is calculated. These are used as weights to then calculate the weighted mean probability of each infection type (the columns in `multi_dens`).
if (FALSE) { # create our arguments multi_dens <- matrix(c(0.5,0.3,0.2,0,0,0,0, 0.25,0.09,0.04,0.3,0.2,0.12,0), nrow = 2,byrow=TRUE) colnames(multi_dens) <- c("a", "b", "c", "a/b", "a/c", "b/c", "a/b/c") # first calculating using a poisson params <- c("mu" = 2) infection_probabilities(multi_dens, params) #> a b c a/b a/c b/c a/b/c #> 0.375 0.195 0.120 0.150 0.100 0.060 0.000 # no using the negative binomial params <- c("mu" = 2, "size" = 1) infection_probabilities(multi_dens, params) #> a b c a/b a/c b/c a/b/c #> 0.400 0.216 0.136 0.120 0.080 0.048 0.000 }