# Example 1: Visualize fit for simulated outbreak data
set.seed(123)
# Simulate ICC intervals from mixed distribution
icc_data <- c(
rnorm(20, mean = 0, sd = 2), # Co-primary cases
rnorm(50, mean = 12, sd = 3), # Primary-secondary cases
rnorm(20, mean = 24, sd = 4) # Primary-tertiary cases
)
icc_data <- round(pmax(icc_data, 0)) # Ensure non-negative
# Plot with estimated parameters
plot_si_fit(
dat = icc_data,
mean = 12.5,
sd = 3.2,
weights = c(0.2, 0.6, 0.15, 0.05),
dist = "normal"
)
# Example 2: Using gamma distribution
plot_si_fit(
dat = icc_data,
mean = 12.0,
sd = 3.5,
weights = c(0.25, 0.65, 0.10),
dist = "gamma",
scaling_factor = 0.8
)
Run the code above in your browser using DataLab