abm_timeseries.jl 1.8 KB
Newer Older
1
2
3
using CovidAlertVaccinationModel
using OnlineStats
using Plots
Peter Jentsch's avatar
Peter Jentsch committed
4
pgfplotsx()
Peter Jentsch's avatar
Peter Jentsch committed
5
using CovidAlertVaccinationModel:vaccination_data,ymo_vac,ymo_attack_rate
6
const samples = 5
7

8
function solve_and_plot_parameters()
9
    p =  CovidAlertVaccinationModel.get_parameters()
10
    display(p)
11
    out,avg_populations = mean_solve(samples, p, record_degrees = true)
12
    p = plot_model(nothing,[nothing],[out],p)
13

14
    ymo_vaccination_ts = mean.(out.daily_immunized_by_age)
15

Peter Jentsch's avatar
Peter Jentsch committed
16
    total_postinf_vaccination = mean.(out.total_postinf_vaccination)#sum.(eachrow(ymo_vaccination_ts[:,180:end]))
Peter Jentsch's avatar
Peter Jentsch committed
17
    final_size = mean.(out.unvac_final_size_by_age)#sum.(eachrow(mean.(out.daily_unvac_cases_by_age)))
Peter Jentsch's avatar
Peter Jentsch committed
18
    total_preinf_vaccination = mean.(out.total_preinf_vaccination)#sum.(eachrow(ymo_vaccination_ts[:,1:180]))
19
20
21
    target_final_size = ymo_attack_rate .*avg_populations
    target_preinf_vac = ymo_vac .* sum(vaccination_data[1:4]) .* avg_populations
    target_postinf_vac = ymo_vac .* sum(vaccination_data[5:end]) .*avg_populations
Peter Jentsch's avatar
Peter Jentsch committed
22
 
23
24
25
26
27
28
    println("obs final size: $final_size, target: $target_final_size")
    println("obs preinf vac: $total_preinf_vaccination, target: $target_preinf_vac")
    println("obs postinf vac: $total_postinf_vaccination,target: $target_postinf_vac")

    total_final_size = sum.(eachrow(mean.(out.daily_cases_by_age))) 
    println("vac + unvac cases proportion: $(total_final_size./avg_populations))")
29

Peter Jentsch's avatar
Peter Jentsch committed
30
31
    mean_deg = mean.(out.avg_weighted_degree_of_vaccinators)
    mean_vac_deg = mean.(out.avg_weighted_degree_of_vaccinators_no_EN)
32
    println("mean weighted degree difference: $(mean_deg), $(mean_vac_deg)")
33
    display(sum.(eachrow(ymo_vaccination_ts)) ./avg_populations) 
34

35
    l = length(p)
Peter Jentsch's avatar
Peter Jentsch committed
36
    savefig(plot(p...; layout = (l,1), size=(800,400*l),leftmargin = 12Plots.mm),"timeseries.pdf")
37
38
    return out
end
39

Peter Jentsch's avatar
Peter Jentsch committed
40

41
out = solve_and_plot_parameters()