Skip to content

Commit

Permalink
update site
Browse files Browse the repository at this point in the history
  • Loading branch information
dosgillespie committed Oct 6, 2021
1 parent 1cd203e commit 52c3a06
Show file tree
Hide file tree
Showing 81 changed files with 2,973 additions and 2,341 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Imports:
lifecycle,
crayon,
TTR,
Rfast
Rfast,
stapmr
RdMacros: Rdpack, lifecycle
VignetteBuilder: knitr
RoxygenNote: 7.1.2
Expand Down
4 changes: 2 additions & 2 deletions R/AlcBinge_stapm.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

#' Calculate variables to inform alcohol binge model - STAPM version \lifecycle{maturing}
#' Calculate variables to inform alcohol binge model - STAPM version
#'
#' Designed to work with simulated individual trajectories of alcohol consumption - stratified by
#' age category, sex and IMD quintile. Assigns coefficients stratified by age category, sex and IMD quintile to
#' the simulated sample of individuals to estimate their characteristics of single occassion drinking
#' the simulated sample of individuals to estimate their characteristics of single occasion drinking
#' at each time step in the simulation.
#'
#' The coefficients used come originally from a study by Hill-McManus 2014,
Expand Down
7 changes: 5 additions & 2 deletions R/AlcLags.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

#' Alcohol lag times \lifecycle{stable}
#' Alcohol lag times
#'
#' Prepare the disease specific functions that describe how a change in alcohol consumption
#' gradually has an effect on the relative risk of disease incidence over time (up to 20 years)
#' since alcohol consumption changed.
#'
#' All lag times are taken from the review by Holmes et al. 2012,
#' All lag times are taken from the review by \insertCite{holmes2012temporal;textual}{tobalcepi} ,
#' and are the numbers used in the current version of SAPM.
#'
#' @param disease_name Character - the name of the disease under consideration.
Expand All @@ -19,6 +19,9 @@
#' @importFrom data.table := setDT setnames data.table
#' @importFrom stapmr %fin%
#'
#' @references
#' \insertRef{holmes2012temporal}{tobalcepi}
#'
#' @export
#'
#'
Expand Down
2 changes: 1 addition & 1 deletion R/ExpandCodes.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


#' Convert groups of ICD-10 codes to single codes \lifecycle{stable}
#' Convert groups of ICD-10 codes to single codes
#'
#' Creates the lookup files for search for single ICD-10 codes related to tobacco and/or alcohol.
#'
Expand Down
10 changes: 6 additions & 4 deletions R/PAFcalc.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

#' Calculate Population Attributable Fractions
#'
#' Uses \code{RRFunc()} and \code{subgroupRisk()} to
#' Uses [tobalcepi::RRFunc()] and [tobalcepi::subgroupRisk()] to
#' calculate population attributable fractions
#' based on the survey data provided.
#'
#'
#' @param data Data table of individual characteristics
#' @param data Data table of individual characteristics. Defaults to NULL.
#' @param rrdata Optional - data table containing individual tobacco and alcohol consumption characteristics
#' with relative risks of disease already assigned. This could be useful for increasing efficiency - saving computer processing time.
#' Defaults to NULL.
Expand Down Expand Up @@ -51,7 +51,7 @@
#' }
#'
PAFcalc <- function(
data,
data = NULL,
rrdata = NULL,
substance,
tob_include_risk_in_former_smokers = TRUE,
Expand All @@ -68,10 +68,12 @@ PAFcalc <- function(
mort_or_morb = c("mort", "morb")[1]
) {

years <- min(data$year):max(data$year)


if(is.null(rrdata)) {

years <- min(data$year):max(data$year)

cat("Assigning relative risks\n")

for(y in years) {
Expand Down
8 changes: 4 additions & 4 deletions R/RRAlc.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


#' Relative risks for alcohol related diseases \lifecycle{stable}
#' Relative risks for alcohol related diseases
#'
#' Computes the relative risks for each alcohol related disease based on the published risk curves.
#'
Expand All @@ -10,13 +10,13 @@
#' indicates protective effects of alcohol, there is an option to remove the protective effect by setting all
#' RR < 1 = 1.
#'
#' Relative risks for partially attributable acute are computed by the \code{PArisk()} function called from within
#' Relative risks for partially attributable acute are computed by the [tobalcepi::PArisk()] function called from within
#' this function. The characteristics of individual single occasion drinking are also calculated within this function
#' using \code{AlcBinge_stapm()}.
#' using [tobalcepi::AlcBinge_stapm()].
#'
#' Relative risks for wholly attributable chronic and wholly attributable acute conditions are calculated
#' based on the extent to which either weekly or daily consumption exceeds a pre-specified threshold. The risk
#' for wholly attributable acute conditions is calculated by the function \code{WArisk_acute()}. We developed a new
#' for wholly attributable acute conditions is calculated by the function [tobalcepi::WArisk_acute()]. We developed a new
#' method to model the absolute risk of wholly attributable acute conditions to suit the STAPM modelling.
#' This new method is based on the method used to model the risk of partially attributable acute conditions -
#' the shape of the risk function is determined by the individual variation in the total annual number of units that
Expand Down
4 changes: 2 additions & 2 deletions R/RRFunc.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' Individual relative risks of disease \lifecycle{maturing}
#' Individual relative risks of disease
#'
#' @description
#' This function takes a sample of individuals and computes each individual's relative risk
Expand All @@ -10,7 +10,7 @@
#' @details See below
#' @section Alcohol risk:
#' For alcohol, the relative risk for each individual for each disease is calculated based on
#' their average weekly alcohol consumption (using \code{RRalc()}).
#' 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,
Expand Down
2 changes: 1 addition & 1 deletion R/RRtob.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' Tobacco relative risks \lifecycle{maturing}
#' Tobacco relative risks
#'
#' Relative risks for current vs. never cigarette smokers.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/TobAlcInt.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


#' Risk interaction between tobacco and alcohol \lifecycle{maturing}
#' Risk interaction between tobacco and alcohol
#'
#' Assigns the disease-specific interaction term (synergy index) appropriate to each
#' individual's tobacco and alcohol consumption.
Expand Down
2 changes: 1 addition & 1 deletion R/TobLags.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' Tobacco lag times \lifecycle{stable}
#' Tobacco lag times
#'
#' Prepare the disease specific functions that describe how a change in tobacco consumption
#' gradually has an effect on the relative risk of disease incidence over time (up to 40 years)
Expand Down
4 changes: 2 additions & 2 deletions R/WArisk_acute.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' Risk of acute conditions wholly-attributable to alcohol \lifecycle{stable}
#' Risk of acute conditions wholly-attributable to alcohol
#'
#' Uses the 'new' binge model methods to calculate the risk
#' that each individual experiences each acute consequence of drinking during one year
Expand All @@ -10,7 +10,7 @@
#' the distribution of characteristics of single occasion drinking described by the
#' parameter estimates of Hill-McManus et al 2014.
#'
#' The function uses the outputs of AlcBinge_stapm()
#' The function uses the outputs of [tobalcepi::AlcBinge_stapm()]
#' to estimate for each individual: (1) the average amount that each individual is expected to
#' drink on a single drinking occasion; (2) the standard deviation of the amount that each individual is expected to
#' drink on a single drinking occasion; (3) the expected number of drinking occasions that
Expand Down
4 changes: 2 additions & 2 deletions R/binge_params.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

#' Parameters to estimate amount drunk on single occassions - STAPM version
#' Parameters to estimate amount drunk on single occasions - STAPM version
#'
#' As our starting point we use the parameter estimates from Hill-McManus et al 2014 - stored within the `tobalcepi` package as the data object `binge_params`.
#' The problem with using these parameters directly in STAPM is that STAPM does not model the individual lifecourse trajectories of
#' The problem with using these parameters directly in STAPM is that STAPM does not model the individual life-course trajectories of
#' some of the covariates investigated by Hill-McManus et al, e.g. income, kids or social status. To get these parameters into a form that can be used in STAPM,
#' we matched them to the individual covariates in a sample of Health Survey for England data from 2011-2017, and then averaged the parameter values
#' by age category, sex and IMD quintiles. The code that does this is in the `data-raw/binge_params` folder of the `tobalcepi` package.
Expand Down
12 changes: 6 additions & 6 deletions R/icd10_lookups.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

#' Diseases related to tobacco and their ICD-10 defintions
#' Diseases related to tobacco and their ICD-10 definitions
#'
#' Deaths in the mortality data are assigned a single ICD-10 code e.g. C00,
#' but for our analysis we need to group these into cause-groups according to groups e.g. C00-C06.
#' To do this, we define each group by its consituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#' To do this, we define each group by its constituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#'
#' @docType data
#'
Expand All @@ -18,11 +18,11 @@
"tob_icd10_lookups"


#' Diseases related to alcohol and their ICD-10 defintions
#' Diseases related to alcohol and their ICD-10 definitions
#'
#' Deaths in the mortality data are assigned a single ICD-10 code e.g. C00,
#' but for our analysis we need to group these into cause-groups according to groups e.g. C00-C06.
#' To do this, we define each group by its consituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#' To do this, we define each group by its constituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#'
#' @docType data
#'
Expand All @@ -37,11 +37,11 @@
"alc_icd10_lookups"


#' Diseases related to both tobacco and alcohol and their ICD-10 defintions
#' Diseases related to both tobacco and alcohol and their ICD-10 definitions
#'
#' Deaths in the mortality data are assigned a single ICD-10 code e.g. C00,
#' but for our analysis we need to group these into cause-groups according to groups e.g. C00-C06.
#' To do this, we define each group by its consituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#' To do this, we define each group by its constituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#'
#' @docType data
#'
Expand Down
2 changes: 1 addition & 1 deletion R/subgroupRisk.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' Summarise relative risk \lifecycle{stable}
#' Summarise relative risk
#'
#' Calculate the sum of the relative risk for all individuals in a subgroup,
#' or calculate the subgroup specific attributable fraction based on the current relative risks.
Expand Down
2 changes: 1 addition & 1 deletion R/tob_alc_risk_int.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' Synergstic effects of tobacco and alcohol risks
#' Synergistic effects of tobacco and alcohol risks
#'
#' @docType data
#'
Expand Down
12 changes: 4 additions & 8 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,10 @@ navbar:
href: https://stapm.gitlab.io/software.html

articles:
- title: "Tobacco relative risks"
contents:
- smoking-disease-risks

- title: "Alcohol relative risks"
- title: "Technical information"
contents:
- alc_partially_attrib_acute
- alc_wholly_attrib_acute
- alc_wholly_attrib_chronic
- tobalcepi
- use_of_disease_risks_in_stapm

reference:
- title: "Use of risk functions"
Expand Down Expand Up @@ -99,6 +94,7 @@ reference:
contents:
- ExpandCodes
- disease_groups
- intervalprob



Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
109 changes: 61 additions & 48 deletions inst/REFERENCES.bib
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
%% This BibTeX bibliography file was created using BibDesk.
%% https://bibdesk.sourceforge.io/
% Encoding: UTF-8
%% Created for Duncan Gillespie at 2020-11-26 11:27:40 +0000
%% Saved with string encoding Unicode (UTF-8)
@comment{jabref-meta: databaseType:bibtex;}
Expand Down Expand Up @@ -936,42 +928,63 @@ @article{Zou2014
Volume = {50},
Year = {2014}}

@article{Pang2015,
__Markedentry = {[cm1dog:]},
Author = {Pang, Q. and Qu, K. and Zhang, J. and Xu, X. and Liu, S. and Song, S. and Wang, R. and Zhang, L. and Wang, Z. and Liu, C.},
Journal = {Journal of Gastroenterology \& Hepatology},
Number = {10},
Pages = {1450-60},
Title = {Cigarette smoking increases the risk of mortality from liver cancer: A clinical-based cohort and meta-analysis},
Type = {Journal Article},
Volume = {30},
Year = {2015}}

@article{Brennan2015,
__Markedentry = {[cm1dog:6]},
Author = {Brennan, Alan and Meier, Petra and Purshouse, Robin and Rafia, Rachid and Meng, Yang and Hill-Macmanus, Daniel and Angus, Colin and Holmes, John},
Doi = {10.1002/hec.3105},
Issn = {1099-1050},
Journal = {Health Economics},
Number = {10},
Pages = {1368-1388},
Title = {The Sheffield Alcohol Policy Model -- A Mathematical Description},
Type = {Journal Article},
Url = {http://dx.doi.org/10.1002/hec.3105},
Volume = {24},
Year = {2015},
Bdsk-Url-1 = {http://dx.doi.org/10.1002/hec.3105}}

@article{Gunningschepers1989,
__Markedentry = {[cm1dog:6]},
Author = {Gunningschepers, L.},
Issn = {0168-8510},
Journal = {Health Policy},
Number = {1-2},
Pages = {1-255},
Title = {The health benefits of preventions - a simulation approach},
Type = {Journal Article},
Url = {<Go to ISI>://WOS:A1989AD34000001},
Volume = {12},
Year = {1989},
Bdsk-Url-1 = {%3CGo%20to%20ISI%3E://WOS:A1989AD34000001}}
@Article{Pang2015,
author = {Pang, Q. and Qu, K. and Zhang, J. and Xu, X. and Liu, S. and Song, S. and Wang, R. and Zhang, L. and Wang, Z. and Liu, C.},
journal = {Journal of Gastroenterology \& Hepatology},
title = {Cigarette smoking increases the risk of mortality from liver cancer: A clinical-based cohort and meta-analysis},
year = {2015},
number = {10},
pages = {1450-60},
volume = {30},
groups = {[cm1dog:]},
type = {Journal Article},
}

@Article{Brennan2015,
author = {Brennan, Alan and Meier, Petra and Purshouse, Robin and Rafia, Rachid and Meng, Yang and Hill-Macmanus, Daniel and Angus, Colin and Holmes, John},
journal = {Health Economics},
title = {The Sheffield Alcohol Policy Model -- A Mathematical Description},
year = {2015},
issn = {1099-1050},
number = {10},
pages = {1368-1388},
volume = {24},
bdsk-url-1 = {http://dx.doi.org/10.1002/hec.3105},
doi = {10.1002/hec.3105},
groups = {cm1dog:6},
type = {Journal Article},
url = {http://dx.doi.org/10.1002/hec.3105},
}

@Article{Gunningschepers1989,
author = {Gunningschepers, L.},
journal = {Health Policy},
title = {The health benefits of preventions - a simulation approach},
year = {1989},
issn = {0168-8510},
number = {1-2},
pages = {1-255},
volume = {12},
bdsk-url-1 = {%3CGo%20to%20ISI%3E://WOS:A1989AD34000001},
groups = {cm1dog:6},
type = {Journal Article},
url = {<Go to ISI>://WOS:A1989AD34000001},
}
@article{holmes2012temporal,
title={The temporal relationship between per capita alcohol consumption and harm: a systematic review of time lag specifications in aggregate time series analyses},
author={Holmes, John and Meier, Petra S and Booth, Andrew and Guo, Yelan and Brennan, Alan},
journal={Drug and alcohol dependence},
volume={123},
number={1-3},
pages={7--14},
year={2012},
publisher={Elsevier}
}
@Comment{jabref-meta: databaseType:bibtex;}

@Comment{jabref-meta: grouping:
0 AllEntriesGroup:;
1 StaticGroup:Markings\;2\;1\;\;\;\;;
2 StaticGroup:[cm1dog:]\;2\;1\;\;\;\;;
2 StaticGroup:cm1dog:6\;2\;1\;\;\;\;;
}
Loading

0 comments on commit 52c3a06

Please sign in to comment.