@@ -122,7 +122,7 @@ years_total <- birth_year_max - birth_year_min
122122years <- seq(birth_year_min, birth_year_max, 1)
123123
124124foi <- c(rep(0., 15), rep(0.065, 15), rep(0.03, 20),
125- rep(0.005, birth_year_max - birth_year_min - 15 - 15 - 20 - 20 + 1)
125+ rep(0.005, birth_year_max - birth_year_min - 15 - 15 - 20 + 1)
126126 )
127127
128128foi_plot <- ggplot(data = data.frame(years = years, foi = foi),
166166In the case of the example, this gives us the following graph:
167167
168168``` {r, echo=FALSE}
169- df_serosurvey <- df_seroprev %>%%
170- filter(year == birth_year_max) %>%%
169+ df_serosurvey <- df_seroprev %>%
170+ filter(year == birth_year_max) %>%
171171 mutate(age = year - cohort_birth_year)
172172serosurvey_plot <- ggplot(data = df_serosurvey,
173173 aes(x = age, y = seroprev)) +
@@ -356,8 +356,6 @@ chik_constant <- fit_seromodel(serosurvey = chik2015,
356356 model_type = "constant",
357357 iter = 1000)
358358
359-
360-
361359chik_constant_plot <- plot_seromodel(seromodel = chik_constant,
362360 serosurvey = chik2015,
363361 size_text = 12)
@@ -369,8 +367,6 @@ Then visualize the three plots together using the `plot_grid()` function of the
369367``` {r chik2015_plot, eval=FALSE}
370368install.packages("cowplot")
371369
372-
373-
374370cowplot::plot_grid(chik_constant_plot,
375371 chik_normal_plot,
376372 chik_normal_log_plot,
@@ -389,14 +385,10 @@ m1_chik <- fit_seromodel(serosurvey = chik2015,
389385 model_type = "constant",
390386 iter = 1000)
391387
392-
393-
394388m2_chik <- fit_seromodel(serosurvey = chik2015,
395389 model_type = "time",
396390 iter = 4000)
397391
398-
399-
400392m3_chik <- fit_seromodel(serosurvey = chik2015,
401393 model_type = "time",
402394 is_log_foi = TRUE,
@@ -420,8 +412,6 @@ chik_normal_log_plot <- plot_seromodel(seromodel = m3_chik,
420412 size_text = 6,
421413 foi_max = 0.1)
422414
423-
424-
425415cowplot::plot_grid(chik_constant_plot, chik_normal_plot, chik_normal_log_plot, ncol=3)
426416```
427417
@@ -568,14 +558,14 @@ virus_serosurvey <- readr::read_rds(
568558 step = 5
569559 )
570560 ) %>%
571- dplyr::group_by(age_group, survey_year = tsur) %>%% dplyr::group_by(age_group, survey_year = tsur) %>% dplyr::summarise(
561+ dplyr::group_by(age_group, survey_year = tsur) %>%
572562 dplyr::summarise(
573563 n_sample = sum(total),
574564 n_seropositive = sum(counts),
575565 age_min = min(age_min),
576566 age_max = max(age_max)
577567 ) %>%
578- dplyr::ungroup() %>%% dplyr::ungroup() %>% dplyr::select(-)
568+ dplyr::ungroup() %>%
579569 dplyr::select(-age_group)
580570```
581571
@@ -590,13 +580,13 @@ Now, how would you implement the Bayesian models available in serofoi via the `f
590580Sample solution for a database:
591581
592582``` {r}
593- virus_serosurvey %>%%.
583+ virus_serosurvey %>%
594584 serofoi::plot_serosurvey()
595585```
596586
597587``` {r, message=FALSE}
598- virus_serosurvey %>%%
599- serofoi::fit_seromodel(model_type = "time", iter = 1000) %>%>% serofoi::plot_seromodel(serosurvey = virus_serosurvey %>%
588+ virus_serosurvey %>%
589+ serofoi::fit_seromodel(model_type = "time", iter = 1000) %>%
600590 serofoi::plot_seromodel(serosurvey = virus_serosurvey)
601591```
602592
0 commit comments