diff --git a/articles/scova.html b/articles/scova.html index 1f976c3..5c8590c 100644 --- a/articles/scova.html +++ b/articles/scova.html @@ -183,45 +183,20 @@

Figure 4
-res <- mod$population_stationary_points()
+res <- mod$population_stationary_points(n_draws = 2000)
 head(res)
-#>        k     p .draw   t0_pop   tp_pop   ts_pop   m1_pop      m2_pop
-#>    <int> <int> <int>    <num>    <num>    <num>    <num>       <num>
-#> 1:     1     1     1 4.410820 8.168995 69.35724 0.447930 -0.03998171
-#> 2:     1     1     2 4.122570 8.220406 69.89225 0.463090 -0.03673517
-#> 3:     1     1     3 3.992784 8.429232 69.34377 0.469506 -0.03856111
-#> 4:     1     1     4 4.129627 8.695681 71.54112 0.440083 -0.03990376
-#> 5:     1     1     5 3.985967 8.358872 64.51578 0.488066 -0.04816820
-#> 6:     1     1     6 4.005071 8.560220 67.98897 0.504561 -0.04687770
-#>         m3_pop    beta_t0   beta_tp   beta_ts  beta_m1    beta_m2     beta_m3
-#>          <num>      <num>     <num>     <num>    <num>      <num>       <num>
-#> 1: -0.00738625  0.0892197 -0.193925 -0.209364 0.200908 -0.0399520 -0.00468916
-#> 2: -0.00799955 -0.0617495 -0.158054  0.556248 0.217805 -0.0366927 -0.00573989
-#> 3: -0.00853792 -0.4106060  0.393672 -0.335826 0.226357 -0.0385086 -0.00599007
-#> 4: -0.00836698 -0.1504630 -0.168249 -0.374482 0.193636 -0.0392022 -0.00675386
-#> 5: -0.00784776 -0.3478230  0.104802  0.918281 0.255142 -0.0207145 -0.00605556
-#> 6: -0.00581304 -0.1382590  0.120330 -0.719028 0.267724 -0.0139650 -0.00431706
-#>         mu_0     mu_p     mu_s infection_history titre_type  rel_drop
-#>        <num>    <num>    <num>            <char>     <char>     <num>
-#> 1: 106.35528 1343.598 246.5053   Infection naive  Ancestral 0.1834666
-#> 2:  87.09383 1218.834 253.4858   Infection naive  Ancestral 0.2079739
-#> 3:  79.60086 1236.706 242.7546   Infection naive  Ancestral 0.1962912
-#> 4:  87.52087 1241.937 218.3664   Infection naive  Ancestral 0.1758272
-#> 5:  79.22562 1339.590 205.4437   Infection naive  Ancestral 0.1533630
-#> 6:  80.28169 1602.548 232.3682   Infection naive  Ancestral 0.1449992
-#>    rel_drop_me  mu_p_me  mu_s_me
-#>          <num>    <num>    <num>
-#> 1:   0.1734832 1315.809 228.7876
-#> 2:   0.1734832 1315.809 228.7876
-#> 3:   0.1734832 1315.809 228.7876
-#> 4:   0.1734832 1315.809 228.7876
-#> 5:   0.1734832 1315.809 228.7876
-#> 6:   0.1734832 1315.809 228.7876
+#> infection_history titre_type mu_p mu_s rel_drop_me mu_p_me mu_s_me +#> <char> <char> <num> <num> <num> <num> <num> +#> 1: Infection naive Ancestral 1343.598 246.5053 0.1734832 1315.809 228.7876 +#> 2: Infection naive Ancestral 1218.834 253.4858 0.1734832 1315.809 228.7876 +#> 3: Infection naive Ancestral 1236.706 242.7546 0.1734832 1315.809 228.7876 +#> 4: Infection naive Ancestral 1241.937 218.3664 0.1734832 1315.809 228.7876 +#> 5: Infection naive Ancestral 1339.590 205.4437 0.1734832 1315.809 228.7876 +#> 6: Infection naive Ancestral 1602.548 232.3682 0.1734832 1315.809 228.7876

The values we’re going to plot are the mean peak titre values -(mu_p_me) and mean set point titre values -(mu_s_me), for different titre types and infection -histories. See data for a full definition of all -the returned columns. Using ggplot2:

+(mu_p) and mean set point titre values (mu_s), +for different titre types and infection histories. See data for a full definition of all the returned +columns. Using ggplot2:

 plot_data <- res[, titre_type := forcats::fct_relevel(
   titre_type,
@@ -235,7 +210,7 @@ 

Figure 4 group = interaction( infection_history, titre_type))) + - geom_point(data = plot_data[.draw <= 2000], + geom_point(data = plot_data, alpha = 0.05, size = 0.2) + geom_point(aes(x = mu_p_me, y = mu_s_me, shape = infection_history), @@ -278,14 +253,14 @@

Figure 5#> method from #> fortify.SpatialPolygonsDataFrame ggplot2 head(res) -#> calendar_date titre_type me lo hi -#> <IDat> <char> <num> <num> <num> -#> 1: 2021-03-08 Ancestral 1122.561 899.7913 1474.929 -#> 2: 2021-03-09 Ancestral 1114.609 882.1468 1450.662 -#> 3: 2021-03-10 Ancestral 1150.423 911.1426 1530.973 -#> 4: 2021-03-11 Ancestral 1121.402 878.6975 1447.972 -#> 5: 2021-03-12 Ancestral 1115.039 851.9412 1443.723 -#> 6: 2021-03-13 Ancestral 1150.059 900.9269 1520.740

+#> calendar_date titre_type me lo hi time_shift +#> <IDat> <char> <num> <num> <num> <num> +#> 1: 2021-03-08 Ancestral 1122.561 899.7913 1474.929 0 +#> 2: 2021-03-09 Ancestral 1114.609 882.1468 1450.662 0 +#> 3: 2021-03-10 Ancestral 1150.423 911.1426 1530.973 0 +#> 4: 2021-03-11 Ancestral 1121.402 878.6975 1447.972 0 +#> 5: 2021-03-12 Ancestral 1115.039 851.9412 1443.723 0 +#> 6: 2021-03-13 Ancestral 1150.059 900.9269 1520.740 0

See data for a definition of all the returned columns. Figure 5 A plots the derived population trajectories. Here we replicate a portion of the graph from the paper, from the minimum date @@ -353,9 +328,7 @@

Figure 5 results_list <- lapply(indices, function(index) { shift <- time_shift_values[index] - result <- mod$simulate_individual_trajectories(n_draws = 50, time_shift = shift) - result[, time_shift:= shift] - result + mod$simulate_individual_trajectories(n_draws = 50, time_shift = shift) }) combined_data <- data.table::data.table(data.table::rbindlist(results_list)) diff --git a/pkgdown.yml b/pkgdown.yml index 3ea2f93..3307b84 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -5,4 +5,4 @@ articles: data: data.html model: model.html scova: scova.html -last_built: 2024-07-15T10:35Z +last_built: 2024-07-15T17:34Z diff --git a/reference/scova.html b/reference/scova.html index 959a547..42e18d3 100644 --- a/reference/scova.html +++ b/reference/scova.html @@ -209,7 +209,6 @@

Method simulate_individu computationally expensive and may take a while to run if n_draws is large.

Usage

scova$simulate_individual_trajectories(
-  t_max = 150,
   summarise = TRUE,
   n_draws = 2500,
   time_shift = 0,
@@ -219,13 +218,9 @@ 

Usage

Arguments

-

t_max
-

Integer. Maximum number of time points to include. Default 150.

- - -
summarise
+

summarise

Boolean. If TRUE, average the individual trajectories to get lo, me and -hi values for the population. If FALSE return the simulated indidivudal trajectories. +hi values for the population, disaggregated by titre type. If FALSE return the indidivudal trajectories. Default TRUE.

@@ -245,7 +240,9 @@

Arguments

Returns

-

A data.table.

+

A data.table. If summarise = TRUE columns are calendar_date, titre_type, me, lo, hi. +If summarise = FALSE, columns are stan_id, draw, t, mu, titre_type, exposure_date, calendar_date, time_shift +and a column for each covariate in the hierarchical model.