Skip to content

Commit

Permalink
calculate incidence rate per 1000 person-years
Browse files Browse the repository at this point in the history
  • Loading branch information
emprestige committed Apr 15, 2024
1 parent c92d63d commit fa263f4
Show file tree
Hide file tree
Showing 13 changed files with 713 additions and 127 deletions.
Binary file modified .RData
Binary file not shown.
374 changes: 314 additions & 60 deletions analysis/data_processing.R

Large diffs are not rendered by default.

52 changes: 39 additions & 13 deletions analysis/dummydata/dummydata_adults.R
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ sim_list = lst(

#date
rsv_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(rsv_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -263,7 +265,9 @@ sim_list = lst(

#date
rsv_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(rsv_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#rsv secondary length of stay
Expand All @@ -283,7 +287,9 @@ sim_list = lst(

#date
flu_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(flu_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -298,7 +304,9 @@ sim_list = lst(

#date
flu_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(flu_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#flu secondary length of stay
Expand All @@ -318,7 +326,9 @@ sim_list = lst(

#date
covid_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(covid_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -333,7 +343,9 @@ sim_list = lst(

#date
covid_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(covid_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#covid secondary length of stay
Expand All @@ -353,7 +365,9 @@ sim_list = lst(

#date
overall_resp_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(overall_resp_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -368,7 +382,9 @@ sim_list = lst(

#date
overall_resp_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(overall_resp_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#unspecified respiratory infection secondary length of stay
Expand All @@ -390,7 +406,9 @@ sim_list = lst(

#date
rsv_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(rsv_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#flu mortality
Expand All @@ -400,7 +418,9 @@ sim_list = lst(

#date
flu_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(flu_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#covid mortality
Expand All @@ -410,7 +430,9 @@ sim_list = lst(

#date
covid_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(covid_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#unspecified respiratory infection secondary care
Expand All @@ -420,7 +442,9 @@ sim_list = lst(

#date
overall_resp_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(overall_resp_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#all cause mortality
Expand All @@ -430,7 +454,9 @@ sim_list = lst(

#date
all_cause_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(all_cause_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

##exclusion criteria
Expand Down
52 changes: 39 additions & 13 deletions analysis/dummydata/dummydata_children_and_adolescents.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ sim_list = lst(

#date
rsv_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(rsv_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -172,7 +174,9 @@ sim_list = lst(

#date
rsv_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(rsv_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#rsv secondary length of stay
Expand All @@ -192,7 +196,9 @@ sim_list = lst(

#date
flu_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(flu_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -207,7 +213,9 @@ sim_list = lst(

#date
flu_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(flu_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#flu secondary length of stay
Expand All @@ -227,7 +235,9 @@ sim_list = lst(

#date
covid_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(covid_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -242,7 +252,9 @@ sim_list = lst(

#date
covid_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(covid_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#covid secondary length of stay
Expand All @@ -262,7 +274,9 @@ sim_list = lst(

#date
overall_resp_primary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(overall_resp_primary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#number of cases
Expand All @@ -277,7 +291,9 @@ sim_list = lst(

#date
overall_resp_secondary_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(overall_resp_secondary == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#unspecified respiratory infection secondary length of stay
Expand All @@ -299,7 +315,9 @@ sim_list = lst(

#date
rsv_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(rsv_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#flu mortality
Expand All @@ -309,7 +327,9 @@ sim_list = lst(

#date
flu_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(flu_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#covid mortality
Expand All @@ -319,7 +339,9 @@ sim_list = lst(

#date
covid_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(covid_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#unspecified respiratory infection secondary care
Expand All @@ -329,7 +351,9 @@ sim_list = lst(

#date
overall_resp_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(overall_resp_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#all cause mortality
Expand All @@ -339,7 +363,9 @@ sim_list = lst(

#date
all_cause_mortality_day = bn_node(
~ as.integer(runif(n = ..n, index_day, index_day + 365))
~ ifelse(all_cause_mortality == TRUE,
as.integer(runif(n = ..n, index_day, index_day + 365)),
NA)
),

#care home resident
Expand Down
Loading

0 comments on commit fa263f4

Please sign in to comment.