Skip to content

Commit

Permalink
update levin ref eq
Browse files Browse the repository at this point in the history
  • Loading branch information
pearsonca committed Oct 23, 2024
1 parent 8edf62b commit bbca337
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions R/aggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ make_weight <- function(f_param, f_dense) {
#'
#' @examples
#' ifr_levin <- function(age_in_years) {
#' scaled <- exp(-7.56 + 0.121 * age_in_years)
#' scaled / (100 + scaled)
#' (10^(-3.27 + 0.0524 * age_in_years))/100
#' }
#' age_limits <- c(seq(0, 69, by = 5), 70, 80, 100)
#' age_pyramid <- data.frame(
Expand Down Expand Up @@ -149,8 +148,7 @@ utils::globalVariables(c("weight", "density", "model_from"))
#'
#' @examples
#' ifr_levin <- function(age_in_years) {
#' scaled <- exp(-7.56 + 0.121 * age_in_years)
#' scaled / (100 + scaled)
#' (10^(-3.27 + 0.0524 * age_in_years))/100
#' }
#' age_limits <- c(seq(0, 69, by = 5), 70, 80, 100)
#' age_pyramid <- data.frame(
Expand Down
3 changes: 1 addition & 2 deletions inst/analysis/scripts/disease_pars.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ require(countrycode)
# from Levin et al https://doi.org/10.1007/s10654-020-00698-1
ifr_opts <- list(
SC2 = \(age_in_years) {
scaled <- exp(-7.56 + 0.121 * age_in_years)
scaled / (100 + scaled)
(10^(-3.27 + 0.0524 * age_in_years))/100
}
)

Expand Down
8 changes: 4 additions & 4 deletions vignettes/intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ The SARS-COV-2 pathogen causes COVID-19, which has a distinctly age-specific mor

```{r ifrfdef}
ifr_levin <- function(age_in_years) {
scaled <- exp(-7.56 + 0.121 * age_in_years)
scaled / (100 + scaled)
(10^(-3.27 + 0.0524 * age_in_years))/100
}
```

Expand All @@ -52,7 +51,8 @@ ggplot(
data.frame(x = 0:100, y = ifr_levin(0:100))
) + aes(x, y) +
geom_line() + theme_minimal() +
labs(x = "Age", y = "Infection-fatality ratio")
scale_y_log10("Infection-fatality ratio") +
labs(x = "Age")
```

To evaluate the threat of an infectious disease, researchers often calculate expected "years life lost" (YLLs). Based on age-specific mortality data, we can estimate how many years individuals at various ages can expect to live. People who die of a modelled illness lose a corresponding number of years of life, depending on their age at death.
Expand Down Expand Up @@ -170,7 +170,7 @@ mapping_dt <- density_dt[,
paramix::alembic(
f_param = ifr_levin, f_dense = .SD,
model_partition = model_agelimits,
output_partition = seq(min(from), max(from) + 1L)
output_partition = seq(min(from), max(from) + 1L, by = 5L)
),
by = name
]
Expand Down

0 comments on commit bbca337

Please sign in to comment.