# Example: Plot serial interval mixture density for influenza-like outbreak
# Set parameters for a typical respiratory infection
mu <- 6.5 # Mean serial interval of 6.5 days
sigma <- 2.8 # Standard deviation of 2.8 days
# Set transmission route weights
w1 <- 0.1 # 10% co-primary cases
w2 <- 0.6 # 60% primary-secondary cases
w3 <- 0.2 # 20% primary-tertiary cases
# Remaining 10% are primary-quaternary cases (1 - w1 - w2 - w3 = 0.1)
# Create sequence of time points
x <- seq(0.1, 30, by = 0.1)
# Calculate mixture density
density_values <- f_gam(x, w1, w2, w3, mu, sigma)
# Plot the result
plot(x, density_values, type = "l", lwd = 2, col = "red",
xlab = "Days", ylab = "Density",
main = "Serial Interval Mixture Density (Gamma Distribution)")
grid()
Run the code above in your browser using DataLab