diff --git a/docs/articles/Brazil_animated.gif b/docs/articles/Brazil_animated.gif index 584b5c2c..855b1c88 100644 Binary files a/docs/articles/Brazil_animated.gif and b/docs/articles/Brazil_animated.gif differ diff --git a/docs/articles/Brazil_animated_2021.gif b/docs/articles/Brazil_animated_2021.gif index ebb6df5d..cfb6d6c6 100644 Binary files a/docs/articles/Brazil_animated_2021.gif and b/docs/articles/Brazil_animated_2021.gif differ diff --git a/docs/articles/Brazil_animated_2023.gif b/docs/articles/Brazil_animated_2023.gif index 87887ece..5bd1903b 100644 Binary files a/docs/articles/Brazil_animated_2023.gif and b/docs/articles/Brazil_animated_2023.gif differ diff --git a/docs/articles/Brazil_animated_2024.gif b/docs/articles/Brazil_animated_2024.gif index 88f3aeab..5278a256 100644 Binary files a/docs/articles/Brazil_animated_2024.gif and b/docs/articles/Brazil_animated_2024.gif differ diff --git a/docs/articles/Germany_animated.gif b/docs/articles/Germany_animated.gif index 505fab74..12ff0559 100644 Binary files a/docs/articles/Germany_animated.gif and b/docs/articles/Germany_animated.gif differ diff --git a/docs/articles/Germany_animated_2021.gif b/docs/articles/Germany_animated_2021.gif index 943f5579..99361bf1 100644 Binary files a/docs/articles/Germany_animated_2021.gif and b/docs/articles/Germany_animated_2021.gif differ diff --git a/docs/articles/Germany_animated_2023.gif b/docs/articles/Germany_animated_2023.gif index 712ca729..3241a901 100644 Binary files a/docs/articles/Germany_animated_2023.gif and b/docs/articles/Germany_animated_2023.gif differ diff --git a/docs/articles/Germany_animated_2024.gif b/docs/articles/Germany_animated_2024.gif index 13c78bfb..33291857 100644 Binary files a/docs/articles/Germany_animated_2024.gif and b/docs/articles/Germany_animated_2024.gif differ diff --git a/docs/articles/IN_animated.gif b/docs/articles/IN_animated.gif index 59024812..357224ce 100644 Binary files a/docs/articles/IN_animated.gif and b/docs/articles/IN_animated.gif differ diff --git a/docs/articles/IN_animated_2021.gif b/docs/articles/IN_animated_2021.gif index 198d30cc..31dbaf4e 100644 Binary files a/docs/articles/IN_animated_2021.gif and b/docs/articles/IN_animated_2021.gif differ diff --git a/docs/articles/IN_animated_2022.gif b/docs/articles/IN_animated_2022.gif index 67fedcd7..4bc59287 100644 Binary files a/docs/articles/IN_animated_2022.gif and b/docs/articles/IN_animated_2022.gif differ diff --git a/docs/articles/IN_animated_2023.gif b/docs/articles/IN_animated_2023.gif index 7c42d92e..9d022a85 100644 Binary files a/docs/articles/IN_animated_2023.gif and b/docs/articles/IN_animated_2023.gif differ diff --git a/docs/articles/IN_animated_latest.gif b/docs/articles/IN_animated_latest.gif index 75e5ca72..5f6efcdf 100644 Binary files a/docs/articles/IN_animated_latest.gif and b/docs/articles/IN_animated_latest.gif differ diff --git a/docs/articles/NYC_animated.gif b/docs/articles/NYC_animated.gif index aad38808..8e27a16f 100644 Binary files a/docs/articles/NYC_animated.gif and b/docs/articles/NYC_animated.gif differ diff --git a/docs/articles/NYC_animated_2023.gif b/docs/articles/NYC_animated_2023.gif index 6c7471b0..a3e8a824 100644 Binary files a/docs/articles/NYC_animated_2023.gif and b/docs/articles/NYC_animated_2023.gif differ diff --git a/docs/articles/NY_animated.gif b/docs/articles/NY_animated.gif index 122ee05b..c305d385 100644 Binary files a/docs/articles/NY_animated.gif and b/docs/articles/NY_animated.gif differ diff --git a/docs/articles/NY_animated_2023.gif b/docs/articles/NY_animated_2023.gif index 3fa18b3d..751ec392 100644 Binary files a/docs/articles/NY_animated_2023.gif and b/docs/articles/NY_animated_2023.gif differ diff --git a/docs/articles/Singapore_animated.gif b/docs/articles/Singapore_animated.gif index 9b3cf78d..de4eb751 100644 Binary files a/docs/articles/Singapore_animated.gif and b/docs/articles/Singapore_animated.gif differ diff --git a/docs/articles/Singapore_animated_2021.gif b/docs/articles/Singapore_animated_2021.gif index 83d2a4c4..67aef21b 100644 Binary files a/docs/articles/Singapore_animated_2021.gif and b/docs/articles/Singapore_animated_2021.gif differ diff --git a/docs/articles/Singapore_animated_2023.gif b/docs/articles/Singapore_animated_2023.gif index 11615950..ff6d2545 100644 Binary files a/docs/articles/Singapore_animated_2023.gif and b/docs/articles/Singapore_animated_2023.gif differ diff --git a/docs/articles/Singapore_animated_2024.gif b/docs/articles/Singapore_animated_2024.gif index 265e05e9..c538b0a4 100644 Binary files a/docs/articles/Singapore_animated_2024.gif and b/docs/articles/Singapore_animated_2024.gif differ diff --git a/docs/articles/South_Africa_animated.gif b/docs/articles/South_Africa_animated.gif index 18d9b9af..ee02400f 100644 Binary files a/docs/articles/South_Africa_animated.gif and b/docs/articles/South_Africa_animated.gif differ diff --git a/docs/articles/South_Africa_animated_2021.gif b/docs/articles/South_Africa_animated_2021.gif index 147cb962..b4733101 100644 Binary files a/docs/articles/South_Africa_animated_2021.gif and b/docs/articles/South_Africa_animated_2021.gif differ diff --git a/docs/articles/VariantAnimation-Brazil.html b/docs/articles/VariantAnimation-Brazil.html index a4cfa454..e7563374 100644 --- a/docs/articles/VariantAnimation-Brazil.html +++ b/docs/articles/VariantAnimation-Brazil.html @@ -1,5 +1,19 @@ -
suppressPackageStartupMessages({
- library(covmuller)
- library(COVID19)
- library(tidyverse)
-})
-theme_set(CovmullerTheme())
gisaid_metadata <- qs::qread("~/data/epicov/metadata_tsv_2024_01_11.qs")
-gisaid_brazil <- gisaid_metadata %>%
- filter(Country == "Brazil") %>%
- filter(Host == "Human")
-# format metadata
-gisaid_brazil <- FormatGISAIDMetadata(gisaid_brazil)
-gisaid_brazil <- gisaid_brazil %>%
- arrange(State, MonthYearCollected) %>%
- filter(pangolin_lineage != "Unknown")
-
-vocs <- GetVOCs()
-custom_voc_mapping <- list(
- `JN.1` = "JN.1",
- `JN.1.*` = "JN.1",
- `HV.1` = "HV.1",
- `HV.1.*` = "HV.1"
-)
-gisaid_brazil <- gisaid_brazil %>% filter(pangolin_lineage != "None")
-
-gisaid_brazil <- CollapseLineageToVOCs(
- variant_df = gisaid_brazil,
- vocs = vocs,
- custom_voc_mapping = custom_voc_mapping,
- summarize = FALSE
-)
+suppressPackageStartupMessages({
+ library(covmuller)
+ library(COVID19)
+ library(tidyverse)
+})
+theme_set(CovmullerTheme())
+gisaid_metadata <- qs::qread("~/data/epicov/metadata_tsv_2024_01_11.qs")
+gisaid_brazil <- gisaid_metadata %>%
+ filter(Country == "Brazil") %>%
+ filter(Host == "Human")
+# format metadata
+gisaid_brazil <- FormatGISAIDMetadata(gisaid_brazil)
+gisaid_brazil <- gisaid_brazil %>%
+ arrange(State, MonthYearCollected) %>%
+ filter(pangolin_lineage != "Unknown")
+
+vocs <- GetVOCs()
+custom_voc_mapping <- list(
+ `B.1` = "B.1",
+ `JN.1` = "JN.1",
+ `JN.1.*` = "JN.1",
+ `HV.1` = "HV.1",
+ `HV.1.*` = "HV.1"
+)
+gisaid_brazil <- gisaid_brazil %>% filter(pangolin_lineage != "None")
+
+gisaid_brazil <- CollapseLineageToVOCs(
+ variant_df = gisaid_brazil,
+ vocs = vocs,
+ custom_voc_mapping = custom_voc_mapping,
+ summarize = FALSE
+)
GetCases <- function() {
- data <- read.csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/cases_deaths/new_cases.csv")
- confirmed <- data %>% select(date, Brazil)
- colnames(confirmed)[2] <- c("cases")
- confirmed$MonthYear <- GetMonthYear(confirmed$date)
- confirmed$WeekYear <- tsibble::yearweek(confirmed$date)
- return(confirmed)
-}
-
-
-GetCasesLong <- function() {
- data <- read.csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/cases_deaths/new_cases.csv")
- confirmed <- data %>% select(date, Brazil)
- colnames(confirmed)[2] <- c("cases")
- confirmed$MonthYear <- GetMonthYear(confirmed$date)
- confirmed$WeekYear <- tsibble::yearweek(confirmed$date)
- confirmed_subset_weekwise <- confirmed %>%
- group_by(WeekYear) %>%
- summarise(cases = mean(cases, na.rm = T)) %>%
- arrange(WeekYear)
- confirmed_subset_weekwise$cases <- ceiling(confirmed_subset_weekwise$cases)
- confirmed_subset_dateweekwise_long_india <- confirmed_subset_weekwise %>%
- rename(n = cases) %>%
- rename(WeekYearCollected = WeekYear)
-}
-
-
-confirmed <- GetCases()
-confirmed_subset_dateweekwise_long <- GetCasesLong()
-gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil)
+GetCases <- function() {
+ data <- read.csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/cases_deaths/new_cases.csv")
+ confirmed <- data %>% select(date, Brazil)
+ colnames(confirmed)[2] <- c("cases")
+ confirmed$MonthYear <- GetMonthYear(confirmed$date)
+ confirmed$WeekYear <- tsibble::yearweek(confirmed$date)
+ return(confirmed)
+}
+
+
+GetCasesLong <- function() {
+ data <- read.csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/cases_deaths/new_cases.csv")
+ confirmed <- data %>% select(date, Brazil)
+ colnames(confirmed)[2] <- c("cases")
+ confirmed$MonthYear <- GetMonthYear(confirmed$date)
+ confirmed$WeekYear <- tsibble::yearweek(confirmed$date)
+ confirmed_subset_weekwise <- confirmed %>%
+ group_by(WeekYear) %>%
+ summarise(cases = mean(cases, na.rm = T)) %>%
+ arrange(WeekYear)
+ confirmed_subset_weekwise$cases <- ceiling(confirmed_subset_weekwise$cases)
+ confirmed_subset_dateweekwise_long_india <- confirmed_subset_weekwise %>%
+ rename(n = cases) %>%
+ rename(WeekYearCollected = WeekYear)
+}
+
+
+confirmed <- GetCases()
+confirmed_subset_dateweekwise_long <- GetCasesLong()
+gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil)
state_month_counts <- SummarizeVariantsMonthwise(gisaid_brazil)
-state_month_counts$State <- "Brazil"
-state_month_prevalence <- CountsToPrevalence(state_month_counts)
-vocs <- GetVOCs()
-
-state_month_prevalence <- CollapseLineageToVOCs(
- variant_df = state_month_prevalence,
- vocs = vocs,
- custom_voc_mapping = custom_voc_mapping, summarize = FALSE
-)
-
-p5 <- StackedBarPlotPrevalence(state_month_prevalence)
-p5
+state_month_counts <- SummarizeVariantsMonthwise(gisaid_brazil)
+state_month_counts$State <- "Brazil"
+state_month_prevalence <- CountsToPrevalence(state_month_counts)
+vocs <- GetVOCs()
+
+state_month_prevalence <- CollapseLineageToVOCs(
+ variant_df = state_month_prevalence,
+ vocs = vocs,
+ custom_voc_mapping = custom_voc_mapping, summarize = FALSE
+)
+
+p5 <- StackedBarPlotPrevalence(state_month_prevalence)
+p5
voc_to_keep <- gisaid_brazil_weekwise %>%
- group_by(lineage_collapsed) %>%
- summarise(n_sum = sum(n)) %>%
- filter(n_sum > 50) %>%
- pull(lineage_collapsed) %>%
- unique()
-gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
-
-brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
-#> # weights: 24 (15 variable)
-#> initial value 439814.238114
-#> iter 10 value 256033.720738
-#> iter 20 value 142234.034232
-#> iter 30 value 120096.926154
-#> iter 40 value 115996.408661
-#> iter 50 value 101694.726489
-#> iter 60 value 101679.150425
-#> iter 60 value 101679.150298
-#> iter 60 value 101679.150294
-#> final value 101679.150294
-#> converged
-the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>", date_breaks = "100 days")
-gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated.gif"), animation = the_anim)
+voc_to_keep <- gisaid_brazil_weekwise %>%
+ group_by(lineage_collapsed) %>%
+ summarise(n_sum = sum(n)) %>%
+ filter(n_sum > 50) %>%
+ pull(lineage_collapsed) %>%
+ unique()
+gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
+
+brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
+#> # weights: 28 (18 variable)
+#> initial value 477631.429726
+#> iter 10 value 252774.699692
+#> iter 20 value 152863.433099
+#> iter 30 value 112374.590589
+#> iter 40 value 97530.709125
+#> iter 50 value 89047.637849
+#> iter 60 value 87375.304507
+#> iter 70 value 87327.814941
+#> final value 87327.549989
+#> converged
+the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>", date_breaks = "100 days")
+gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated.gif"), animation = the_anim)
Look at cases from 2022,
-confirmed_subset_dateweekwise_long <- GetCasesLong() %>%
- filter(WeekYearCollected >= tsibble::yearweek("2021 W35"))
-
-gisaid_brazil_subset <- gisaid_brazil %>% filter(MonthYearCollected > "Oct 2021")
-gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil_subset)
-
-voc_to_keep <- gisaid_brazil_weekwise %>%
- group_by(lineage_collapsed) %>%
- summarise(n_sum = sum(n)) %>%
- filter(n_sum > 50) %>%
- pull(lineage_collapsed) %>%
- unique()
-gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
-
-brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
-#> # weights: 24 (15 variable)
-#> initial value 242593.481577
-#> iter 10 value 67367.516549
-#> iter 20 value 50299.321008
-#> iter 30 value 48568.582744
-#> iter 40 value 48399.528910
-#> iter 50 value 48216.001702
-#> final value 48215.991366
-#> converged
-the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>", date_breaks = "100 days")
-gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated_2021.gif"), animation = the_anim)
Look at cases from 2023
-confirmed_subset_dateweekwise_long <- GetCasesLong() %>%
- filter(WeekYearCollected >= tsibble::yearweek("2022 W35"))
-
-gisaid_brazil_subset <- gisaid_brazil %>% filter(MonthYearCollected > "October 2022")
-gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil_subset)
-
-voc_to_keep <- gisaid_brazil_weekwise %>%
- group_by(lineage_collapsed) %>%
- summarise(n_sum = sum(n)) %>%
- filter(n_sum > 50) %>%
- pull(lineage_collapsed) %>%
- unique()
-gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
-
-brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
-#> # weights: 16 (9 variable)
-#> initial value 42782.430279
-#> iter 10 value 25591.413964
-#> iter 20 value 24307.240935
-#> iter 20 value 24307.240870
-#> final value 24307.240870
-#> converged
-the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>")
-gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated_2023.gif"), animation = the_anim)
+confirmed_subset_dateweekwise_long <- GetCasesLong() %>%
+ filter(WeekYearCollected >= tsibble::yearweek("2021 W35"))
+
+gisaid_brazil_subset <- gisaid_brazil %>% filter(MonthYearCollected > "Oct 2021")
+gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil_subset)
+
+voc_to_keep <- gisaid_brazil_weekwise %>%
+ group_by(lineage_collapsed) %>%
+ summarise(n_sum = sum(n)) %>%
+ filter(n_sum > 50) %>%
+ pull(lineage_collapsed) %>%
+ unique()
+gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
+
+brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
+#> # weights: 20 (12 variable)
+#> initial value 217901.798964
+#> iter 10 value 68117.519899
+#> iter 20 value 38972.173600
+#> iter 30 value 38224.146018
+#> iter 40 value 37696.212812
+#> iter 50 value 37684.646795
+#> final value 37684.553986
+#> converged
+the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>", date_breaks = "100 days")
+gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated_2021.gif"), animation = the_anim)
Look at cases from 2023
+
+confirmed_subset_dateweekwise_long <- GetCasesLong() %>%
+ filter(WeekYearCollected >= tsibble::yearweek("2022 W35"))
+
+gisaid_brazil_subset <- gisaid_brazil %>% filter(MonthYearCollected > "October 2022")
+gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil_subset)
+
+voc_to_keep <- gisaid_brazil_weekwise %>%
+ group_by(lineage_collapsed) %>%
+ summarise(n_sum = sum(n)) %>%
+ filter(n_sum > 50) %>%
+ pull(lineage_collapsed) %>%
+ unique()
+gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
+
+brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
+#> # weights: 12 (6 variable)
+#> initial value 33904.273841
+#> iter 10 value 19641.239613
+#> iter 20 value 18993.304042
+#> iter 30 value 18989.592419
+#> iter 40 value 18989.385555
+#> iter 40 value 18989.385495
+#> final value 18989.385495
+#> converged
+the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>")
+gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated_2023.gif"), animation = the_anim)
Look at cases in the past few weeks
-confirmed_subset_dateweekwise_long <- GetCasesLong() %>%
- filter(WeekYearCollected >= tsibble::yearweek("2023 W23"))
-
-gisaid_brazil_subset <- gisaid_brazil %>% filter(MonthYearCollected > "June 2023")
-gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil_subset)
-
-voc_to_keep <- gisaid_brazil_weekwise %>%
- group_by(lineage_collapsed) %>%
- summarise(n_sum = sum(n)) %>%
- filter(n_sum > 50) %>%
- pull(lineage_collapsed) %>%
- unique()
-gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
-
-brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
-#> # weights: 16 (9 variable)
-#> initial value 7589.961627
-#> iter 10 value 3097.145675
-#> iter 20 value 2913.994381
-#> iter 30 value 2912.954507
-#> final value 2905.363627
-#> converged
-the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>")
-gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated_2024.gif"), animation = the_anim)
+confirmed_subset_dateweekwise_long <- GetCasesLong() %>%
+ filter(WeekYearCollected >= tsibble::yearweek("2023 W23"))
+
+gisaid_brazil_subset <- gisaid_brazil %>% filter(MonthYearCollected > "June 2023")
+gisaid_brazil_weekwise <- SummarizeVariantsWeekwise(gisaid_brazil_subset)
+
+voc_to_keep <- gisaid_brazil_weekwise %>%
+ group_by(lineage_collapsed) %>%
+ summarise(n_sum = sum(n)) %>%
+ filter(n_sum > 50) %>%
+ pull(lineage_collapsed) %>%
+ unique()
+gisaid_brazil_weekwise <- gisaid_brazil_weekwise %>% filter(lineage_collapsed %in% voc_to_keep)
+
+brazil_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_brazil_weekwise, confirmed_subset_dateweekwise_long)
+#> # weights: 12 (6 variable)
+#> initial value 6014.902280
+#> iter 10 value 2614.497681
+#> iter 20 value 2554.179438
+#> iter 30 value 2546.094236
+#> iter 40 value 2544.802563
+#> iter 50 value 2544.464767
+#> iter 60 value 2544.297783
+#> iter 60 value 2544.297759
+#> iter 60 value 2544.297759
+#> final value 2544.297759
+#> converged
+the_anim <- PlotVariantPrevalenceAnimated(brazil_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Brazil by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>")
+gganimate::anim_save(filename = here::here("docs/articles/Brazil_animated_2024.gif"), animation = the_anim)
## Warning: There was 1 warning in `mutate()`.
-## ℹ In argument: `lineage_collapsed = case_when(...)`.
-## Caused by warning in `grepl()`:
-## ! argument 'pattern' has length > 1 and only the first element will be used
-## There was 1 warning in `mutate()`.
-## ℹ In argument: `lineage_collapsed = case_when(...)`.
-## Caused by warning in `grepl()`:
-## ! argument 'pattern' has length > 1 and only the first element will be used
-## There was 1 warning in `mutate()`.
-## ℹ In argument: `lineage_collapsed = case_when(...)`.
-## Caused by warning in `grepl()`:
-## ! argument 'pattern' has length > 1 and only the first element will be used
-## There was 1 warning in `mutate()`.
-## ℹ In argument: `lineage_collapsed = case_when(...)`.
-## Caused by warning in `grepl()`:
-## ! argument 'pattern' has length > 1 and only the first element will be used
-## There was 1 warning in `mutate()`.
-## ℹ In argument: `lineage_collapsed = case_when(...)`.
-## Caused by warning in `grepl()`:
-## ! argument 'pattern' has length > 1 and only the first element will be used
-
-p5 <- StackedBarPlotPrevalence(state_month_prevalence)
+)
+
+p5 <- StackedBarPlotPrevalence(state_month_prevalence)
p5
+-voc_to_keep <- gisaid_NYC_weekwise %>% group_by(lineage_collapsed) %>% summarise(n_sum = sum(n)) %>% @@ -209,22 +189,30 @@
Project wee gisaid_NYC_weekwise <- gisaid_NYC_weekwise %>% filter(lineage_collapsed %in% voc_to_keep) newyork_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_NYC_weekwise, confirmed_subset_dateweekwise_long)
## # weights: 24 (15 variable) -## initial value 275423.890331 -## iter 10 value 103526.406601 -## iter 20 value 57662.832925 -## iter 30 value 52088.430642 -## iter 40 value 51128.645887 -## iter 50 value 50130.386333 -## iter 60 value 50124.942658 -## final value 50124.923846 +
-## # weights: 32 (21 variable) +## initial value 319645.515462 +## iter 10 value 129725.918553 +## iter 20 value 95448.294186 +## iter 30 value 66627.314993 +## iter 40 value 61240.137015 +## iter 50 value 59773.177006 +## iter 60 value 56245.973825 +## iter 70 value 55654.886438 +## iter 80 value 55647.792960 +## iter 90 value 55627.197638 +## iter 100 value 55623.924667 +## iter 110 value 55622.181447 +## iter 120 value 55621.085564 +## iter 120 value 55621.085151 +## iter 120 value 55621.085150 +## final value 55621.085150 ## converged
@@ -230,14 +238,14 @@+the_anim <- PlotVariantPrevalenceAnimated(newyork_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in New York City by variant", caption = "**Source: gisaid.org and NYC Health**<br>", date_breaks = "14 days") gganimate::anim_save(filename = here::here("docs/articles/NYC_animated.gif"), animation = the_anim)
Look at cases from 2023:
-diff --git a/docs/articles/VariantAnimation-NewYork_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/VariantAnimation-NewYork_files/figure-html/unnamed-chunk-5-1.png index f116559e..1526a9b8 100644 Binary files a/docs/articles/VariantAnimation-NewYork_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/VariantAnimation-NewYork_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/VariantAnimation-Singapore.html b/docs/articles/VariantAnimation-Singapore.html index f3f27eee..c00cb110 100644 --- a/docs/articles/VariantAnimation-Singapore.html +++ b/docs/articles/VariantAnimation-Singapore.html @@ -118,6 +118,7 @@+confirmed_subset_dateweekwise_long <- confirmed %>% filter(MonthYear > "April 2023") %>% group_by(WeekYear) %>% @@ -246,20 +234,21 @@
Project wee cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_weekwise, confirmed_subset_dateweekwise_long)
-## # weights: 20 (12 variable) ## initial value 6255.885166 -## iter 10 value 3026.359758 -## iter 20 value 2921.703016 -## iter 30 value 2920.866234 -## iter 40 value 2919.388425 -## iter 50 value 2915.871424 -## final value 2915.869578 +## iter 10 value 3451.483231 +## iter 20 value 3290.395049 +## iter 30 value 3287.151312 +## iter 40 value 3286.131901 +## iter 50 value 3284.254882 +## iter 60 value 3283.660561 +## final value 3283.634015 ## converged
@@ -235,16 +246,15 @@+the_anim <- PlotVariantPrevalenceAnimated(cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in New York City by variant", caption = "**Source: gisaid.org and NYC Health**<br>")
-## `geom_line()`: Each group consists of only one observation. ## ℹ Do you need to adjust the group aesthetic? ## `geom_line()`: Each group consists of only one observation. ## ℹ Do you need to adjust the group aesthetic?
diff --git a/docs/articles/VariantAnimation-NYC_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/VariantAnimation-NYC_files/figure-html/unnamed-chunk-4-1.png index 5aa7ce1b..e4043458 100644 Binary files a/docs/articles/VariantAnimation-NYC_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/VariantAnimation-NYC_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/VariantAnimation-NewYork.html b/docs/articles/VariantAnimation-NewYork.html index 338d49ba..6c4cbcef 100644 --- a/docs/articles/VariantAnimation-NewYork.html +++ b/docs/articles/VariantAnimation-NewYork.html @@ -199,15 +199,26 @@+Project wee gisaid_NY_weekwise <- gisaid_NY_weekwise %>% filter(lineage_collapsed %in% voc_to_keep) newyork_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_NY_weekwise, confirmed_subset_dateweekwise_long) -#> # weights: 24 (15 variable) -#> initial value 619721.222900 -#> iter 10 value 195727.910791 -#> iter 20 value 170255.896718 -#> iter 30 value 155698.851947 -#> iter 40 value 154824.652436 -#> iter 50 value 154462.055572 -#> iter 60 value 154363.600858 -#> final value 154363.141606 +#> # weights: 32 (21 variable) +#> initial value 719222.684345 +#> iter 10 value 250462.078514 +#> iter 20 value 201636.251764 +#> iter 30 value 160252.304662 +#> iter 40 value 144230.414078 +#> iter 50 value 141156.595823 +#> iter 60 value 140119.368791 +#> iter 70 value 139877.250294 +#> iter 80 value 139856.880616 +#> iter 90 value 139853.933404 +#> iter 100 value 139852.923006 +#> iter 110 value 139851.719163 +#> iter 120 value 139839.294051 +#> iter 130 value 139798.844398 +#> iter 140 value 139798.172817 +#> iter 150 value 139789.702568 +#> iter 160 value 139789.263859 +#> iter 170 value 139783.874106 +#> final value 139769.529380 #> converged the_anim <- PlotVariantPrevalenceAnimated(newyork_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in New York state by variant", caption = "**Source: gisaid.org and covid19nytimes**<br>", date_breaks = "28 days") gganimate::anim_save(filename = here::here("docs/articles/NY_animated.gif"), animation = the_anim)
Project wee gisaid_weekwise <- gisaid_weekwise %>% filter(lineage_collapsed %in% voc_to_keep) cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_weekwise, confirmed_subset_dateweekwise_long) -#> # weights: 16 (9 variable) -#> initial value 51058.607614 -#> iter 10 value 30075.975445 -#> iter 20 value 25816.045505 -#> iter 30 value 25743.056638 -#> iter 40 value 25726.530411 -#> iter 50 value 25725.121302 -#> iter 60 value 25724.530866 -#> iter 70 value 25724.410164 -#> final value 25724.409451 +#> # weights: 20 (12 variable) +#> initial value 59275.598315 +#> iter 10 value 32489.530379 +#> iter 20 value 23853.543116 +#> iter 30 value 23765.301220 +#> iter 40 value 23676.483714 +#> iter 50 value 23659.962306 +#> iter 60 value 23657.736857 +#> final value 23657.605377 #> converged the_anim <- PlotVariantPrevalenceAnimated(cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in New York state by variant", caption = "**Source: gisaid.org and covid19nytimes**<br>") gganimate::anim_save(filename = here::here("docs/articles/NY_animated_2023.gif"), animation = the_anim)
Get variants data for Singapore vocs <- GetVOCs() custom_voc_mapping <- list( + `B.1` = "B.1", `JN.1` = "JN.1", `JN.1.*` = "JN.1", `HV.1` = "HV.1", @@ -199,15 +200,22 @@
Project wee gisaid_singapore_weekwise <- gisaid_singapore_weekwise %>% filter(lineage_collapsed %in% voc_to_keep) singapore_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_singapore_weekwise, confirmed_subset_dateweekwise_long) -#> # weights: 24 (15 variable) -#> initial value 82510.523558 -#> iter 10 value 33090.560838 -#> iter 20 value 26735.659433 -#> iter 30 value 25247.257923 -#> iter 40 value 25213.729733 -#> iter 50 value 25117.939097 -#> iter 60 value 25114.301460 -#> final value 25114.254352 +#> # weights: 36 (24 variable) +#> initial value 101182.191786 +#> iter 10 value 48652.582101 +#> iter 20 value 39085.719681 +#> iter 30 value 28592.344153 +#> iter 40 value 25826.843049 +#> iter 50 value 24977.172867 +#> iter 60 value 24844.233642 +#> iter 70 value 23985.157994 +#> iter 80 value 23669.365207 +#> iter 90 value 23455.798545 +#> iter 100 value 23434.628311 +#> iter 110 value 23434.622239 +#> iter 110 value 23434.622024 +#> iter 110 value 23434.622009 +#> final value 23434.622009 #> converged the_anim <- PlotVariantPrevalenceAnimated(singapore_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Singapore by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>", date_breaks = "100 days") gganimate::anim_save(filename = here::here("docs/articles/Singapore_animated.gif"), animation = the_anim)
Project wee singapore_cases_pred_prob_sel_long <- FitMultinomWeekly(gisaid_singapore_weekwise, confirmed_subset_dateweekwise_long) #> # weights: 24 (15 variable) -#> initial value 65922.414392 -#> iter 10 value 28220.263731 -#> iter 20 value 17092.115644 -#> iter 30 value 15938.368484 -#> iter 40 value 15926.599474 -#> iter 50 value 15915.823096 -#> iter 60 value 15892.865985 -#> final value 15891.837481 +#> initial value 65890.162721 +#> iter 10 value 36987.620326 +#> iter 20 value 22026.664366 +#> iter 30 value 20152.953185 +#> iter 40 value 20134.991682 +#> iter 50 value 20120.576654 +#> iter 60 value 20118.637434 +#> final value 20117.468685 #> converged the_anim <- PlotVariantPrevalenceAnimated(singapore_cases_pred_prob_sel_long, title = "Estimated cases (weekly average) in Singapore by variant", caption = "**Source: gisaid.org and ourworldindata.org/coronavirus**<br>", date_breaks = "100 days") gganimate::anim_save(filename = here::here("docs/articles/Singapore_animated_2021.gif"), animation = the_anim)