Commit 6a9167ab authored by Kevin Kunzmann's avatar Kevin Kunzmann

corrected bug in recombination of imputed with known dead individuals

parent 3f53e219
...@@ -202,6 +202,7 @@ tbl_posteriors <- tibble( ...@@ -202,6 +202,7 @@ tbl_posteriors <- tibble(
``` ```
```{r final-imputations} ```{r final-imputations}
# start by adding confirmed <= 180d deaths back in
tbl_final_imputations <- readr::read_csv( tbl_final_imputations <- readr::read_csv(
sprintf('%s/tbl_gose_imputation.csv', config$datapath), sprintf('%s/tbl_gose_imputation.csv', config$datapath),
col_types = "cinncD" col_types = "cinncD"
...@@ -209,7 +210,7 @@ tbl_final_imputations <- readr::read_csv( ...@@ -209,7 +210,7 @@ tbl_final_imputations <- readr::read_csv(
select(gupi, Subject.DeathDate) %>% select(gupi, Subject.DeathDate) %>%
distinct %>% distinct %>%
transmute( transmute(
gupi = gupi, gupi = gupi,
death_days = difftime(Subject.DeathDate, "1970-01-01", unit = "days") %>% as.numeric death_days = difftime(Subject.DeathDate, "1970-01-01", unit = "days") %>% as.numeric
) %>% ) %>%
left_join(tbl_posteriors, by = "gupi") %>% left_join(tbl_posteriors, by = "gupi") %>%
...@@ -220,7 +221,7 @@ tbl_final_imputations <- readr::read_csv( ...@@ -220,7 +221,7 @@ tbl_final_imputations <- readr::read_csv(
) %>% ) %>%
mutate( mutate(
probability = ifelse( probability = ifelse(
is.na(death_days), is.na(death_days) | (death_days > 180),
probability, probability,
ifelse(gose != "gose_1_probability", 0.0, 1.0) ifelse(gose != "gose_1_probability", 0.0, 1.0)
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment