Package 'attrib'

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] , Aurora Hofman [aut] , Folkehelseinstituttet [cph]
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

Help Index


Fake data for mortality in Norway

Description

Fake data for mortality in Norway

Usage

data_fake_county

Format

location_code

Location code of the Norwegian municipalities

week

Week

season

Season used for influenza like illnesses

yrwk

Year and week

x

Number of weeks from the start of the season

pop

Population size

pr100_ili

Per hundred ILI, percentage of consultations diagnosed as influenza like illnesses

pr100_ili_lag_1

pr100_ili_lag_1

temperature

temperature

temperature_high

temperature_high

deaths

deaths


Fake data for mortality in Norway nationally

Description

Fake data for mortality in Norway nationally

Usage

data_fake_nation

Format

location_code

Location code

week

Week

season

Season used for influenza like illnesses

yrwk

Year and week

x

Number of weeks from the start of the season

pop

Population size

pr100_ili

Per hundred ILI, percentage of consultations diagnosed as influenza like illnesses

pr100_ili_lag_1

pr100_ili_lag_1

temperature

temperature

temperature_high

temperature_high

deaths

deaths


Estimates simulations of expected responses

Description

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.

Usage

est_attrib(fit, data, exposures, n_sim = 500)

Arguments

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: vignette("intro", package="attrib")

Details

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")

Value

Dataset with expected responses for all simulations including expected responses given the exposure reference values

Examples

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

Description

Data fit using glmer from lme4 with family poisson to fit the dataset with the given formula.

Usage

fit_attrib(data, response, fixef, ranef, offset = NULL)

Arguments

data

The observed data to be fitted.

response

The response

fixef

The fixed effects

ranef

The random effects

offset

The offsets.

Value

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")

Examples

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)

Generates simulations of expected mortality by simulating the model coefficients.

Description

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.

Usage

sim(fit, data, n_sim)

Arguments

fit

A model fit created by fit_attrib

data

The data with either observed values or reference values.

n_sim

Number of simulations

Details

vignette("intro", package="attrib")

Value

A dataset with 500 simulations of the expected response for each row in the original dataset.

Examples

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)