Outbreak Magnitude

Summarize the number of farms and total cattle infected in simulated outbreaks

Infection Summary

summarize_infections() summarizes infection metrics by iteration.

Code
## Summarize infection metrics for each iteration
infect_summary <- summarize_infections(infection)

View a subset of infect_summary

Code
## Filter data to scenario
infect_summary_select <- infect_summary %>%
  filter(region == "central") %>%
  filter(scenario_type == "suboptimal") %>%
  filter(preclinical == 2)

## Select and order columns to display
infect_summary_select <- infect_summary_select[c("iteration", "farms_infected", "cattle_infected", "first_infect", "last_infect")]

## Check data
head(infect_summary_select)
iteration farms_infected cattle_infected first_infect last_infect
1 82 18980 10 54
2 13 4893 10 27
3 179 51364 10 85
4 10 2271 10 36
5 20 6115 10 42
6 116 54607 10 111

Summary Statistics

generate_infect_statistics() returns summary statistics for each modeling scenario. Results are grouped by region, scenario_type, and preclinical. The output is filtered by summary and region to compare farms_infected and cattle_infected between scenarios.

Code
infect_config_summary <- generate_infect_statistics(infect_summary)

## Filter to farms
farms_inf_summary <- infect_config_summary %>%    
  filter(summary == "farms_infected")

## Filter to cattle
cattle_inf_summary <- infect_config_summary %>%    
  filter(summary == "cattle_infected")

Infected Farms

The number of infected farms

Code
## Filter to central region
farms_central_summary <- farms_inf_summary %>%
  filter(region == "central")

## Select and order columns
farms_central_summary <- farms_central_summary[c("scenario_type", "preclinical", "mean", "q05", "q25", "q50", "q75", "q95")]

farms_central_summary
scenario_type preclinical mean q05 q25 q50 q75 q95
optimal 0 7.352 2.0 2.00 3.0 6.00 20.05
optimal 1 12.714 2.0 3.00 5.0 11.00 56.00
optimal 2 23.366 2.0 4.00 9.0 22.00 94.00
optimal 3 72.506 3.0 7.00 15.5 67.00 372.35
suboptimal 0 46.924 4.0 9.00 22.0 55.25 176.05
suboptimal 1 106.394 6.0 15.00 41.0 140.25 408.15
suboptimal 2 250.570 7.0 24.00 81.0 369.75 939.20
suboptimal 3 578.078 9.0 45.75 312.5 1008.25 1729.50
low-virulence 6 3722.938 1491.7 3034.50 3917.0 4595.00 5520.00
Code
## Filter to eastern region
farms_eastern_summary <- farms_inf_summary %>%
  filter(region == "eastern")

## Select and order columns
farms_eastern_summary <- farms_eastern_summary[c("scenario_type", "preclinical", "mean", "q05", "q25", "q50", "q75", "q95")]

farms_eastern_summary
scenario_type preclinical mean q05 q25 q50 q75 q95
optimal 0 6.564 2.00 2.00 4.0 7.00 20.05
optimal 1 13.590 2.00 3.00 6.0 13.00 57.05
optimal 2 30.400 2.00 5.00 10.0 26.00 124.05
optimal 3 54.782 2.00 7.00 15.0 61.25 237.10
suboptimal 0 41.674 4.00 10.00 21.0 51.00 134.05
suboptimal 1 89.450 5.00 16.00 41.0 94.75 330.70
suboptimal 2 186.164 6.00 26.00 74.0 268.25 684.10
suboptimal 3 457.092 9.00 43.00 250.5 655.50 1620.15
low-virulence 6 3101.590 61.85 2435.75 3412.5 4187.25 4993.10

Total Cattle

The total number of cattle on infected farms

Code
## Filter to central region
cattle_central_summary <- cattle_inf_summary %>%
  filter(region == "central")

## Select and order columns
cattle_central_summary <- cattle_central_summary[c("scenario_type", "preclinical", "mean", "q05", "q25", "q50", "q75", "q95")]

cattle_central_summary
scenario_type preclinical mean q05 q25 q50 q75 q95
optimal 0 4347.228 1627.00 1627.00 1708.5 2899.25 13058.80
optimal 1 7215.244 1627.00 1675.75 2089.5 6008.25 30945.40
optimal 2 13340.340 1627.00 1803.50 3940.5 11030.25 51068.45
optimal 3 44453.892 1651.85 2390.25 7635.0 33766.50 233234.75
suboptimal 0 25979.990 1755.60 4074.25 11906.5 28267.75 103639.20
suboptimal 1 62846.180 1873.15 7052.00 18708.5 72516.75 275944.45
suboptimal 2 156362.888 2106.40 10801.75 41477.5 201033.25 666540.50
suboptimal 3 455723.392 2607.75 20374.75 167747.5 666590.75 1930262.85
low-virulence 6 3243921.747 913215.30 2260734.25 3449833.0 4241386.75 5265010.15
Code
## Filter to eastern region
cattle_eastern_summary <- cattle_inf_summary %>%
  filter(region == "eastern")

## Select and order columns
cattle_eastern_summary <- cattle_eastern_summary[c("scenario_type", "preclinical", "mean", "q05", "q25", "q50", "q75", "q95")]

cattle_eastern_summary
scenario_type preclinical mean q05 q25 q50 q75 q95
optimal 0 2686.652 1164.00 1164.00 1247.0 2236.25 8903.30
optimal 1 5315.418 1164.00 1208.75 1843.0 4832.50 21955.40
optimal 2 11114.532 1164.00 1355.50 2824.0 8958.25 47171.35
optimal 3 17873.322 1164.00 1766.75 4779.0 21289.75 79301.35
suboptimal 0 16142.812 1267.80 2524.25 6678.5 18888.50 57099.95
suboptimal 1 31848.112 1453.00 4203.00 13355.5 33844.50 126665.70
suboptimal 2 62893.166 1606.45 6739.00 23120.0 83048.75 253791.15
suboptimal 3 153263.466 1933.45 13765.75 74901.5 215762.00 601651.45
low-virulence 6 1019390.812 14089.10 799123.25 1161486.0 1366618.00 1600987.95

Significance Test

Perform significance testing on optimal and suboptimal detection scenarios.

Code
## Filter out low virulence scenarios
no_LV <- infection %>%
  filter(scenario_type != "low-virulence")

no_LV_summary <- summarize_infections(no_LV)

Linear Model

Code
## Filter to central region
no_LV_central_summary <- no_LV_summary %>%
  filter(region == "central")

model_central_cattle <- lm(log(cattle_infected) ~ preclinical * scenario_type, 
                       data = no_LV_central_summary)

summary(model_central_cattle)

Call:
lm(formula = log(cattle_infected) ~ preclinical * scenario_type, 
    data = no_LV_central_summary)

Residuals:
    Min      1Q  Median      3Q     Max 
-4.2343 -0.8894 -0.2982  1.0457  4.4918 

Coefficients:
                             Estimate Std. Error t value Pr(>|t|)    
(Intercept)                   8.60372    0.04628 185.898  < 2e-16 ***
preclinical1                  0.46313    0.06545   7.076 1.75e-12 ***
preclinical2                  1.01288    0.06545  15.475  < 2e-16 ***
preclinical3                  1.83846    0.06545  28.088  < 2e-16 ***
scenario_type.L               1.08133    0.06545  16.521  < 2e-16 ***
preclinical1:scenario_type.L  0.19539    0.09256   2.111   0.0348 *  
preclinical2:scenario_type.L  0.39906    0.09256   4.311 1.66e-05 ***
preclinical3:scenario_type.L  0.59686    0.09256   6.448 1.27e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.464 on 3992 degrees of freedom
Multiple R-squared:  0.4032,    Adjusted R-squared:  0.4022 
F-statistic: 385.3 on 7 and 3992 DF,  p-value: < 2.2e-16
Code
## Filter to eastern region
no_LV_eastern_summary <- no_LV_summary %>%
  filter(region == "eastern")

model_eastern_cattle <- lm(log(cattle_infected) ~ preclinical * scenario_type, 
                       data = no_LV_eastern_summary)

summary(model_eastern_cattle)

Call:
lm(formula = log(cattle_infected) ~ preclinical * scenario_type, 
    data = no_LV_eastern_summary)

Residuals:
    Min      1Q  Median      3Q     Max 
-3.7779 -0.8537 -0.2152  0.9186  4.4417 

Coefficients:
                             Estimate Std. Error t value Pr(>|t|)    
(Intercept)                   8.21104    0.04188 196.060  < 2e-16 ***
preclinical1                  0.47570    0.05923   8.032 1.25e-15 ***
preclinical2                  0.95705    0.05923  16.159  < 2e-16 ***
preclinical3                  1.59329    0.05923  26.901  < 2e-16 ***
scenario_type.L               0.99160    0.05923  16.742  < 2e-16 ***
preclinical1:scenario_type.L  0.10213    0.08376   1.219  0.22280    
preclinical2:scenario_type.L  0.21745    0.08376   2.596  0.00947 ** 
preclinical3:scenario_type.L  0.46956    0.08376   5.606 2.21e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.324 on 3992 degrees of freedom
Multiple R-squared:  0.3794,    Adjusted R-squared:  0.3783 
F-statistic: 348.6 on 7 and 3992 DF,  p-value: < 2.2e-16

ANOVA

Code
anova(model_central_cattle)
Df Sum Sq Mean Sq F value Pr(>F)
preclinical 3 1873.93075 624.643584 291.61346 0
scenario_type 1 3804.16224 3804.162244 1775.96463 0
preclinical:scenario_type 3 99.43042 33.143473 15.47296 0
Residuals 3992 8550.96743 2.142026 NA NA
Code
anova(model_eastern_cattle)
Df Sum Sq Mean Sq F value Pr(>F)
preclinical 3 1391.58709 463.862363 264.46615 0e+00
scenario_type 1 2826.86883 2826.868825 1611.70891 0e+00
preclinical:scenario_type 3 61.25672 20.418906 11.64162 1e-07
Residuals 3992 7001.79806 1.753957 NA NA

Plot Cattle Numbers

plot_infected_cattle() returns a plot with the duration of incubation phase transmission on the x-axis and the median number of infected cattle (log10) on the y-axis.

Code
central_cattle_plot <- plot_infected_cattle(cattle_central_summary, "central")

central_cattle_plot

Code
eastern_cattle_plot <- plot_infected_cattle(cattle_eastern_summary, "eastern")

eastern_cattle_plot