r_eff calculates the effective reproductive number $$R_eff$$ in a population with heterogeneous mixing, and with heterogeneous susceptibility to infection such as due to immunisation.

## Usage

r_eff(r0, contact_matrix, demography_vector, susceptibility, p_susceptibility)

## Arguments

r0

The basic reproductive number $$R_0$$ of the infection.

contact_matrix

Social contact matrix. Entry $$m_{ij}$$ gives average number of contacts in group $$i$$ reported by participants in group $$j$$

demography_vector

Demography vector. Entry $$v_{i}$$ gives proportion of total population in group $$i$$ (model will normalise if needed).

susceptibility

A matrix giving the susceptibility of individuals in demographic group $$i$$ and risk group $$k$$.

p_susceptibility

A matrix giving the probability that an individual in demography group $$i$$ is in risk (or susceptibility) group $$k$$. Each row represents the overall distribution of individuals in demographic group $$i$$ across risk groups, and each row must sum to 1.0.

## Value

A single number of the effective reproductive number of the infection in the population.

## Examples

# load example POLYMOD data included in the package
data(polymod_uk)
r0 <- 2.0
contact_matrix <- polymod_uk$contact_matrix demography_vector <- polymod_uk$demography_vector

# define the number of age and susceptibility groups
n_demo_grps <- length(demography_vector)
n_risk_grps <- 3

# In this example, all risk groups from all age groups are fully
# susceptible
susceptibility <- matrix(
data = 1, nrow = n_demo_grps, ncol = n_risk_grps
)

p_susceptibility <- matrix(
data = 1, nrow = n_demo_grps, ncol = n_risk_grps
)
# p_susceptibility rows must sum to 1.0
p_susceptibility <- p_susceptibility / rowSums(p_susceptibility)

# calculate R_effective
r_eff(
r0 = r0,
contact_matrix = contact_matrix,
demography_vector = demography_vector,
susceptibility = susceptibility,
p_susceptibility = p_susceptibility
)
#> [1] 2