RRFunc.Rd
This function takes a sample of individuals and computes each individual's relative risk for each disease according to their current tobacco and alcohol consumption. There is an option to tailor this to the alcohol only, tobacco only, or joint tobacco and alcohol contexts.
RRFunc(
data,
substance = c("tob", "alc", "tobalc"),
k_year = NULL,
alc_diseases = tobalcepi::alc_disease_names,
alc_mort_and_morb = c("ischaemic_heart_disease", "livercirrhosis",
"haemorrhagic_stroke", "ischaemic_stroke"),
alc_risk_lags = TRUE,
alc_indiv_risk_trajectories_store = NULL,
alc_protective = TRUE,
alc_wholly_chronic_thresholds = c(2, 2),
alc_wholly_acute_thresholds = c(3, 4),
grams_ethanol_per_unit = 8,
tob_diseases = tobalcepi::tob_disease_names,
tob_include_risk_in_former_smokers = TRUE,
tobalc_include_int = FALSE,
tobalc_int_data = tobalcepi::tob_alc_risk_int,
show_progress = FALSE,
within_model = TRUE,
country = c("England", "Scotland")[1],
other_lag_function = "Cancers"
)
Data table of individual characteristics - this function uses current smoking and drinking status/amount.
Whether to compute relative risks for just alcohol ("alc"), just tobacco ("tob") or joint risks for tobacco and alcohol ("tobalc").
Integer giving the current year of the simulation. Defaults to NULL.
Character vector of alcohol related diseases.
Character vector of the names of the alcohol related diseases that have separate risk functions for mortality and morbidity.
Logical - should each individual's relative risks for alcohol be lagged according to their past individual life-course trajectory of relative risks. Defaults to FALSE. This should only be set to TRUE for a model run that simulates individual trajectories, and should be FALSE if this function is being used as part of the calculation of population attributable fractions.
Data table that stores each individual's life-course history of relative risks for alcohol related diseases. This can be NULL for the first year of the simulation, and if this is the case then the function will initialise and return this storage data table after the first year of the simulation.
Logical - whether to include the protective effects of alcohol in the risk function. Defaults to TRUE. If TRUE, then the part of the risk function < 1 is set to equal 1.
Numeric vector - the thresholds in UK standard units of alcohol per day over which individuals begin to experience an elevated risk for chronic diseases that are wholly attributable to alcohol. Input in the order c(female, male). Defaults to the current UK healthy drinking threshold of 14 units/week for females and males, or 2 units/day.
Numeric vector - the thresholds in UK standard units of alcohol /day over which individuals begin to experience an elevated risk for acute diseases that are wholly attributable to alcohol. Input in the form c(female, male). Defaults to 3 units/day for females and 4 units/day for males.
Numeric value giving the conversion factor for the number of grams of pure ethanol in one UK standard unit of alcohol.
Character vector of tobacco related diseases.
Logical - whether the residual risks of smoking in former smokers should be considered (defaults to TRUE).
Logical - in computing joint relative risks for tobacco and alcohol, should a (synergistic/multiplicative) interaction between exposure to tobacco and alcohol be included. Defaults to FALSE. If TRUE, then only interactive effects for oesophageal, pharynx, oral cavity and larynx cancers are considered.
Data table containing the disease-specific interactions between tobacco and alcohol.
Logical - Should the progress of the loop through diseases be shown. Defaults to FALSE.
Logical - is the function being used within a STAPM simulation. Defaults to TRUE. This is used only to determine which version of the alcohol binge model function to use - there is a version that suits the STAPM model by using only the age, sex and IMD quintile variables that are tracked within the STAPM model simulation.
Character string - "England" or "Scotland"
Character - the name of the lag function to use for tobacco related conditions that are not categorised as CVD, COPD, or Cancer. Options: c("Cancers", "CVD", "COPD", "immediate"). The default is "Cancers", which gives the most conservative (i.e. slowest) estimate of the rate of decline in the risk of disease after quitting smoking.
Two data tables are returned:
"data_plus_rr" is a version of "data" with added columns that give each individual's relative risk for each disease.
"new_alc_indiv_risk_trajectories_store" is a version of "alc_indiv_risk_trajectories_store" with the relative risks for the current year added to the store.
See below
For alcohol, the relative risk for each individual for each disease is calculated based on their average weekly alcohol consumption (using [tobalcepi::RRalc()]). Alcohol consumption is converted to grams of ethanol consumed on average in a day, and this is truncated at 150g/day. We assume 8 grams of ethanol per UK standard unit of alcohol. For diseases that have separate mortality and morbidity risk functions, separate variables are created containing the relative risks for each for the same disease. Unlike tobacco, there is no "former drinker" state in our alcohol modelling, meaning that individuals are not recorded as being former drinkers -- instead their alcohol consumption just falls to zero and their relative risk for disease changes accordingly.
To account for the lagged effects of changes to the amount that individuals drink on their
current risk of disease,
it is necessary to add memory to our modelling,
which we do in this function by storing each individual's
past trajectory of the relative risk that they were assigned
for each disease. Doing so adds extra computations and makes the model run a bit slower.
In each year of the simulation, the current relative risk of an individual is
adjusted to take account of
each individual's stored drinking histories.
This adjustment takes the form of a weighted average of current and past relative risk,
where the weights are proportional to
the disease-specific lag function (which comes from AlcLags
).
This method is slightly different to the method that was developed for SAPM,
as it needed to be adapted to suit the modelling of individual life-course
trajectories of alcohol consumption.
For tobacco, the relative risk for each individual is calculated based on whether
they are a current, former or never smoker (using RRtob
).
Currently, all current smokers have the same relative risk regardless of
the amount they currently smoke or have smoked in the past (but we are in the process
of developing inputs and a function to take account of dose-response effects of
the amount currently smoked using RRTobDR
).
Former smokers are initially given the relative risk associated with current smokers (using RRtob
),
which we then scale according to a disease-specific
function that describes how risk declines after quitting smoking (which comes from TobLags
).
After 40 years from quitting, we assume that risk has reached the level of a never smoker.
If both tobacco and alcohol are being considered in a joint model,
we combine the relative risks for current drinkers and smokers.
In implementing this combination of risks, we have built-in the option
to take account of synergistic effects (i.e. when the combined
risk from tobacco and alcohol consumption is more that would be expected
from the additive combination of risks, because for some conditions that
tobacco and alcohol consumption interact physiologically, and that interaction
further increases disease risk).
We currently include estimates of synergistic effects for
oral, pharyngeal, laryngeal and oesophageal cancers.
We apply these effects using TobAlcInt
by scaling the joint risks by a 'synergy index',
which takes the result of a meta-analysis of the additional
risk faced by people because they consume both tobacco and alcohol.
if (FALSE) {
#############################
## ALCOHOL
# Simulate individual data
# Using the parameters for the Gamma distribution from Kehoe et al. 2012
n <- 1e4
grams_ethanol_day <- rgamma(n, shape = 0.69, scale = 19.03)
# Note: the socioeconomic and other variables are needed for the binge model
data <- data.table(
year = 2016,
weekmean = grams_ethanol_day * 7 / 8,
#peakday = 2 * grams_ethanol_day / 8,
age = rpois(n, 30),
sex = sample(x = c("Male", "Female"), size = n, replace = T),
income5cat = "1_lowest income",
imd_quintile = "5_most_deprived",
kids = "0",
social_grade = "C2DE",
eduend4cat = "16-18", # age finished education
ethnic2cat = "white", # white / non-white
employ2cat = "yes", # employed / not
wtval = rnorm(n, mean = 60, sd = 5), # weight in kg
htval = rnorm(n, mean = 1.7, sd = .1) # height in m
)
# Add individual ids to the data
data <- MakeSeeds(data, n = 0)
# Disease names
alc_disease_names <- c(
"Pharynx",
"Ischaemic_heart_disease",
"LiverCirrhosis",
"Transport_injuries",
"Alcohol_poisoning",
"Alcoholic_gastritis"
)
test_data <- copy(data)
test_data1 <- RRFunc(
data = test_data,
substance = "alc",
k_year = 2017,
alc_diseases = alc_disease_names,
alc_indiv_risk_trajectories_store = NULL,
alc_wholly_chronic_thresholds = c(2, 2),
alc_wholly_acute_thresholds = c(3, 4),
show_progress = TRUE
)
test_data1
test_data <- copy(data)
test_data[ , year := 2017]
test_data2 <- RRFunc(
data = test_data,
substance = "alc",
k_year = 2018,
alc_diseases = alc_disease_names,
alc_indiv_risk_trajectories_store = test_data1$new_alc_indiv_risk_trajectories_store,
alc_wholly_chronic_thresholds = c(2, 2),
alc_wholly_acute_thresholds = c(3, 4),
show_progress = TRUE
)
test_data2
#############################
## TOBACCO
tob_disease_names <- c(
"Pharynx",
"Chronic_obstructive_pulmonary_disease",
"Ischaemic_heart_disease",
"Lung",
"Influenza_clinically_diagnosed",
"Diabetes",
"Schizophrenia"
)
n <- 1e4
data <- data.table(
smk.state = sample(x = c("current", "former", "never"), size = n, replace = T),
time_since_quit = sample(x = 0:40, size = n, replace = T),
age = rpois(n, 30),
sex = sample(x = c("Male", "Female"), size = n, replace = T)
)
data[smk.state != "former", time_since_quit := NA]
# Tobacco relative risks for Pharygeal cancer
RRFunc(
data = data,
substance = "tob",
tob_diseases = tob_disease_names,
show_progress = TRUE,
other_lag_function = "Cancers"
)
#############################
## TOBACCO AND ALCOHOL
}