diff --git a/CovidAlertVaccinationModel/src/mixing_distributions.jl b/CovidAlertVaccinationModel/src/mixing_distributions.jl index f054ef68750769ef6538538bcc34f7181eeb7da1..e55c0c24ccb35fa7d0c8a2c1fe9c2e1586f7ee6c 100644 --- a/CovidAlertVaccinationModel/src/mixing_distributions.jl +++ b/CovidAlertVaccinationModel/src/mixing_distributions.jl @@ -72,15 +72,23 @@ const unemployment_matrix = alpha_matrix( ) function make_workschool_mixing_matrix() + + #all geometric with means given ws_mixing = map(t->from_mean(t...),[ (Geometric{Float64}, 4.104848) (Geometric{Float64},2.568782) (Geometric{Float64},0.017729) (Geometric{Float64}, 0.975688) (Geometric{Float64},5.057572) (Geometric{Float64},0.021307) (Geometric{Float64},0.001937) (Geometric{Float64},0.00722) (Geometric{Float64}, 0.022134) ]) + #symmetrize WS mixing with respect to the population proportions in the data ws_mixing_w_unemployment_symmetrized = symmetrize_means(get_household_data_proportions(),ws_mixing) + + #define a function that adjusts the means of W according to the unemployment_matrix ws_adjust_mean(W) = (5/7) .* (1 .- unemployment_matrix) ./ ( mean.(W) + (5/7) .* (1 .- unemployment_matrix)) + + #create a zero weighted distribution where the zero-weight is given by the unemployment_matrix, and the non-zero weight is given by ws_mixing, symmetrized, with means adjust upwards ws_mixing_w_unemployment_symmetrized_weekday_adjusted = ZWDist.(unemployment_matrix,Geometric.(ws_adjust_mean(ws_mixing_w_unemployment_symmetrized))) + return ws_mixing_w_unemployment_symmetrized_weekday_adjusted end @@ -90,6 +98,7 @@ const initial_rest_mixing_matrix = symmetrize_means(get_household_data_proporti (Geometric{Float64},0.264822) (Geometric{Float64},0.734856) (Geometric{Float64},0.667099) ])) const initial_workschool_mixing_matrix = make_workschool_mixing_matrix() + @views function ws_sample(age) return rand.(initial_workschool_mixing_matrix[age,:]) * (rand(RNG) < (5/7)) end diff --git a/IntervalsModel/plots/Distributions.Poisson_hh.pdf b/IntervalsModel/plots/Distributions.Poisson_hh.pdf index 59c6dc34a42eb4d4c5d4e91247e4e1908e692f2d..d4306ba282f4e4c3f84ff2e8f990d579838f6fd3 100644 Binary files a/IntervalsModel/plots/Distributions.Poisson_hh.pdf and b/IntervalsModel/plots/Distributions.Poisson_hh.pdf differ diff --git a/IntervalsModel/plots/Distributions.Poisson_rest.pdf b/IntervalsModel/plots/Distributions.Poisson_rest.pdf index 9ee55d21d58faf43f7e41e9b0aea0ad8623b3c28..423ab213935aab00bb169c648e6869240f1d0ed9 100644 Binary files a/IntervalsModel/plots/Distributions.Poisson_rest.pdf and b/IntervalsModel/plots/Distributions.Poisson_rest.pdf differ diff --git a/IntervalsModel/plots/Distributions.Poisson_ws.pdf b/IntervalsModel/plots/Distributions.Poisson_ws.pdf index 6600d6cb26e061f98d79e694555e99e9e1c0c668..93e76096de51589b942af2d8939441cbbd283329 100644 Binary files a/IntervalsModel/plots/Distributions.Poisson_ws.pdf and b/IntervalsModel/plots/Distributions.Poisson_ws.pdf differ diff --git a/IntervalsModel/plots/hh.pdf b/IntervalsModel/plots/hh.pdf index cff0607309127e87f4567daf1fa744d8f00b2293..cb2ea57e7a2f74c6ab59f7c901ea9106deb28698 100644 Binary files a/IntervalsModel/plots/hh.pdf and b/IntervalsModel/plots/hh.pdf differ diff --git a/IntervalsModel/plots/rest.pdf b/IntervalsModel/plots/rest.pdf index cbb8327c9afc9c80bb6f89ad796fde236790395b..7a9508562df23f5bac32a80b897550e819257d31 100644 Binary files a/IntervalsModel/plots/rest.pdf and b/IntervalsModel/plots/rest.pdf differ diff --git a/IntervalsModel/plots/ws.pdf b/IntervalsModel/plots/ws.pdf index e7b3a2c58a15c5aee4a8c37fa9054ef50129b608..354a33d09f8599674c9db7328c359ad2e9b7a61d 100644 Binary files a/IntervalsModel/plots/ws.pdf and b/IntervalsModel/plots/ws.pdf differ diff --git a/IntervalsModel/simulation_data/rest.dat b/IntervalsModel/simulation_data/rest.dat index 8e63b0a603bd96555d80677e078ee8275e4c5875..8466b37ac94b7d788ce7f773c72cf016a78ea47f 100644 Binary files a/IntervalsModel/simulation_data/rest.dat and b/IntervalsModel/simulation_data/rest.dat differ diff --git a/IntervalsModel/simulation_data/ws.dat b/IntervalsModel/simulation_data/ws.dat index 7d8aa86f2aab3e4d0148b836513b5e0b948b877d..4c2d041a7430f02230055804f1270caaa6a13172 100644 Binary files a/IntervalsModel/simulation_data/ws.dat and b/IntervalsModel/simulation_data/ws.dat differ diff --git a/IntervalsModel/src/IntervalsModel.jl b/IntervalsModel/src/IntervalsModel.jl index 5d4aaead05f8c0c8bf1af14e01b0d1333dfdfa44..9c9d712328867569a847c46220438ebbd632afe0 100644 --- a/IntervalsModel/src/IntervalsModel.jl +++ b/IntervalsModel/src/IntervalsModel.jl @@ -46,9 +46,9 @@ Runs parameter estimation for the three scenarios, hh, ws, and rest. """ function main() # do_hh(500) - do_ws(500) - do_rest(500) - # plot_all() + do_ws(5000) + do_rest(5000) + plot_all() end """ diff --git a/IntervalsModel/src/utils.jl b/IntervalsModel/src/utils.jl index 843730bebff44c5998352a409af181342b354cce..dae20583ffa482c882b58ad653c3289ec10a6154 100644 --- a/IntervalsModel/src/utils.jl +++ b/IntervalsModel/src/utils.jl @@ -39,8 +39,8 @@ function get_rest_data() path = "$PACKAGE_FOLDER/network-data/Timeuse/Rest/RData" data_table_by_age = map(collect(keys(swap_dict))) do age data_table = CSV.File(path*"$age.csv") |> Tables.matrix - weights = Weights(data_table[:,1]) - durs = data_table[:,2] + weights = Weights(data_table[:,2]) + durs = data_table[:,3] Symbol(age) => (;durs, weights) end return (;data_table_by_age...) @@ -53,8 +53,8 @@ function get_ws_data() path = "$PACKAGE_FOLDER/network-data/Timeuse/WS/WorkschoolData" data_table_by_age = map(collect(keys(swap_dict))) do age data_table = CSV.File(path*"$age.csv") |> Tables.matrix - weights = Weights(data_table[:,1]) - durs = data_table[:,2] + weights = Weights(data_table[:,2]) + durs = data_table[:,3] Symbol(age) => (;durs, weights) end return (;data_table_by_age...)