Title: | Attributable Burden of Disease |
---|---|
Description: | Provides functions for estimating the attributable burden of disease due to risk factors. The posterior simulation is performed using arm::sim as described in Gelman, Hill (2012) <doi:10.1017/CBO9780511790942> and the attributable burden method is based on Nielsen, Krause, Molbak <doi:10.1111/irv.12564>. |
Authors: | Richard Aubrey White [aut, cre]
|
Maintainer: | Richard Aubrey White <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2021.1.2 |
Built: | 2025-02-11 03:57:50 UTC |
Source: | https://github.com/cran/attrib |
Fake data for mortality in Norway
data_fake_county
data_fake_county
Location code of the Norwegian municipalities
Week
Season used for influenza like illnesses
Year and week
Number of weeks from the start of the season
Population size
Per hundred ILI, percentage of consultations diagnosed as influenza like illnesses
pr100_ili_lag_1
temperature
temperature_high
deaths
Fake data for mortality in Norway nationally
data_fake_nation
data_fake_nation
Location code
Week
Season used for influenza like illnesses
Year and week
Number of weeks from the start of the season
Population size
Per hundred ILI, percentage of consultations diagnosed as influenza like illnesses
pr100_ili_lag_1
temperature
temperature_high
deaths
For each exposure the dataset is copied and the original value replaced by the reference value. Then the sim function is used to generate 500 simulations of expected responses for each row. Finally the dataset is transformed to obtain expected response for original and reference values of the given exposures for each original row of the dataset.
est_attrib(fit, data, exposures, n_sim = 500)
est_attrib(fit, data, exposures, n_sim = 500)
fit |
A model fit constructed by fit_attrib |
data |
The observed data |
exposures |
The exposures that will get reference expected mortalities |
n_sim |
Number of simulations For more details see the help vignette:
|
The burden method is based on Nielsen, Krause, Molbak <doi:10.1111/irv.12564>.
For more details see the help vignette:
vignette("intro", package="attrib")
Dataset with expected responses for all simulations including expected responses given the exposure reference values
response <- "deaths" fixef <- "pr100_ili_lag_1 + sin(2 * pi * (week - 1) / 52) + cos(2 * pi * (week - 1) / 52)" ranef <- " (pr100_ili_lag_1| season)" offset <- "log(pop)" data <- attrib::data_fake_nation fit <- fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset) exposures <- c(pr100_ili_lag_1 = 0) n_sim <- 5 new_data <- est_attrib(fit, data, exposures, n_sim) new_data[]
response <- "deaths" fixef <- "pr100_ili_lag_1 + sin(2 * pi * (week - 1) / 52) + cos(2 * pi * (week - 1) / 52)" ranef <- " (pr100_ili_lag_1| season)" offset <- "log(pop)" data <- attrib::data_fake_nation fit <- fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset) exposures <- c(pr100_ili_lag_1 = 0) n_sim <- 5 new_data <- est_attrib(fit, data, exposures, n_sim) new_data[]
Data fit using glmer from lme4 with family poisson to fit the dataset with the given formula.
fit_attrib(data, response, fixef, ranef, offset = NULL)
fit_attrib(data, response, fixef, ranef, offset = NULL)
data |
The observed data to be fitted. |
response |
The response |
fixef |
The fixed effects |
ranef |
The random effects |
offset |
The offsets. |
The model fit of the data with additional attributes offset, response and fit_fix. Offset and response are the same as in the input and fit_fix is the linear model of the fix effects.
For more details see the help vignette:
vignette("intro", package="attrib")
response <- "deaths" fixef <- "pr100_ili_lag_1 + sin(2 * pi * (week - 1) / 52) + cos(2 * pi * (week - 1) / 52)" ranef <- " (pr100_ili_lag_1| season)" offset <- "log(pop)" data <- attrib::data_fake_nation fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset)
response <- "deaths" fixef <- "pr100_ili_lag_1 + sin(2 * pi * (week - 1) / 52) + cos(2 * pi * (week - 1) / 52)" ranef <- " (pr100_ili_lag_1| season)" offset <- "log(pop)" data <- attrib::data_fake_nation fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset)
With the given fit from fit_attrib the function sim, from package arm as described in Gelman, Hill (2012) <doi:10.1017/CBO9780511790942>, is used to generate 500 simulations of all the coefficients, from there respective posterior distributions. This is then used to compute the expected response for all simulations and rows in the input dataset.
sim(fit, data, n_sim)
sim(fit, data, n_sim)
fit |
A model fit created by fit_attrib |
data |
The data with either observed values or reference values. |
n_sim |
Number of simulations |
vignette("intro", package="attrib")
A dataset with 500 simulations of the expected response for each row in the original dataset.
response <- "deaths" fixef <- "pr100_ili_lag_1 + sin(2 * pi * (week - 1) / 52) + cos(2 * pi * (week - 1) / 52)" ranef <- " (pr100_ili_lag_1| season)" offset <- "log(pop)" data <- attrib::data_fake_nation fit <- fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset) n_sim <- 5 sim(fit, data, n_sim)
response <- "deaths" fixef <- "pr100_ili_lag_1 + sin(2 * pi * (week - 1) / 52) + cos(2 * pi * (week - 1) / 52)" ranef <- " (pr100_ili_lag_1| season)" offset <- "log(pop)" data <- attrib::data_fake_nation fit <- fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset) n_sim <- 5 sim(fit, data, n_sim)