This function calculates the value of f0 based on the component, where the components represent the transmission routes: Co-Primary (CP), Primary-Secondary (PS), Primary-Tertiary (PT), and Primary-Quaternary (PQ). We split the PS, PT and PQ routes into two parts, such that
component 1: CP route
component 2+3: PS route
component 4+5: PT route
component 6+7: PQ route
Details
If the dist = gamma, then the mean (\(\mu\)) and standard deviation (sigma) are converted into the shape (k) and scale (theta) parameters for the gamma distribution, such that the mean (\(\mu\) ) and variance (\(\sigma^2\)) are given by: $$\mu = k \times \theta$$ $$\sigma^2 = k \times \theta^2$$.
Examples
# Basic example with normal distribution
# Component 2 represents primary-secondary transmission
f0(x = 0.5, mu = 12, sigma = 3, comp = 2, dist = "normal")
#> [1] 8.569012e-05
# Same parameters with gamma distribution
f0(x = 0.5, mu = 12, sigma = 3, comp = 2, dist = "gamma")
#> [1] 1.195475e-15
# Component 1 represents co-primary transmission
f0(x = 0.3, mu = 8, sigma = 2, comp = 1, dist = "normal")
#> [1] 0.3927174
# Calculate for all transmission route components
x_val <- 0.4
mu_val <- 10
sigma_val <- 3
# Components 1-7 represent different transmission routes:
# 1: Co-Primary, 2+3: Primary-Secondary, 4+5: Primary-Tertiary, 6+7: Primary-Quaternary
sapply(1:7, function(comp) {
f0(x_val, mu_val, sigma_val, comp, "normal")
})
#> [1] 2.246751e-01 9.536353e-04 3.920512e-04 2.618487e-06 1.076492e-06
#> [6] 8.277535e-09 3.402996e-09