diff --git a/R/PAFcalc.R b/R/PAFcalc.R index 4352128..05f24ad 100644 --- a/R/PAFcalc.R +++ b/R/PAFcalc.R @@ -29,6 +29,10 @@ #' @param mort_or_morb Character string - whether the risk functions for conditions with separate mortality and morbidity risk functions #' should refer to mortality or morbidity. Values could be "mort" or "morb". Default is "mort". #' @param country Character string - "England" or "Scotland" +#' @param other_lag_function 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. #' #' @return Returns a data.table containing the estimated PAFs. #' @@ -67,7 +71,8 @@ PAFcalc <- function( tobalc_include_int = FALSE, within_model = FALSE, mort_or_morb = c("mort", "morb")[1], - country = c("England", "Scotland")[1] + country = c("England", "Scotland")[1], + other_lag_function = "Cancers" ) { @@ -113,7 +118,8 @@ PAFcalc <- function( show_progress = TRUE, within_model = within_model, tobalc_include_int = tobalc_include_int, - country = country) + country = country, + other_lag_function = other_lag_function) if(y == years[1]) { diff --git a/R/RRFunc.R b/R/RRFunc.R index c030f35..55778f0 100644 --- a/R/RRFunc.R +++ b/R/RRFunc.R @@ -102,6 +102,10 @@ #' 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. #' @param country Character string - "England" or "Scotland" +#' @param other_lag_function 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. #' #' @return Two data tables are returned: #' \itemize{ @@ -224,7 +228,9 @@ #' data = data, #' substance = "tob", #' tob_diseases = tob_disease_names, -#' show_progress = TRUE +#' show_progress = TRUE, +#' other_lag_function = "Cancers" +#' #' ) #' #' @@ -250,7 +256,8 @@ RRFunc <- function( tobalc_int_data = tobalcepi::tob_alc_risk_int, show_progress = FALSE, within_model = TRUE, - country = c("England", "Scotland")[1] + country = c("England", "Scotland")[1], + other_lag_function = "Cancers" ) { @@ -712,7 +719,7 @@ RRFunc <- function( # Matching on the time since quit data <- merge( data, - tobalcepi::TobLags(d), + tobalcepi::TobLags(d, other_lag_function = other_lag_function), by = "time_since_quit", all.x = T, all.y = F, sort = F) data[is.na(prop_risk_reduction), prop_risk_reduction := 0L] diff --git a/R/TobLags.R b/R/TobLags.R index 5a75bf9..28e940e 100644 --- a/R/TobLags.R +++ b/R/TobLags.R @@ -51,9 +51,13 @@ #' #' #' @examples -#' +#' \dontrun{ #' TobLags("Pharynx") -#' +#' +#' TobLags("Low_back_pain", other_lag_function = "immediate") +#' TobLags("Low_back_pain", other_lag_function = "CVD") +#' TobLags("Low_back_pain", other_lag_function = "Cancers") +#'} TobLags <- function( disease_name = c("Pharynx", "Oral_cavity"), n_years = 40, diff --git a/man/PAFcalc.Rd b/man/PAFcalc.Rd index 6122f10..e4b011c 100644 --- a/man/PAFcalc.Rd +++ b/man/PAFcalc.Rd @@ -20,7 +20,8 @@ PAFcalc( tobalc_include_int = FALSE, within_model = FALSE, mort_or_morb = c("mort", "morb")[1], - country = c("England", "Scotland")[1] + country = c("England", "Scotland")[1], + other_lag_function = "Cancers" ) } \arguments{ @@ -73,6 +74,11 @@ from the results of a STAPM model simulation. Defaults to FALSE.} should refer to mortality or morbidity. Values could be "mort" or "morb". Default is "mort".} \item{country}{Character string - "England" or "Scotland"} + +\item{other_lag_function}{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.} } \value{ Returns a data.table containing the estimated PAFs. diff --git a/man/RRFunc.Rd b/man/RRFunc.Rd index 275a026..ce2b36a 100644 --- a/man/RRFunc.Rd +++ b/man/RRFunc.Rd @@ -23,7 +23,8 @@ RRFunc( tobalc_int_data = tobalcepi::tob_alc_risk_int, show_progress = FALSE, within_model = TRUE, - country = c("England", "Scotland")[1] + country = c("England", "Scotland")[1], + other_lag_function = "Cancers" ) } \arguments{ @@ -90,6 +91,11 @@ there is a version that suits the STAPM model by using only the age, sex and IMD that are tracked within the STAPM model simulation.} \item{country}{Character string - "England" or "Scotland"} + +\item{other_lag_function}{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.} } \value{ Two data tables are returned: @@ -282,7 +288,9 @@ RRFunc( data = data, substance = "tob", tob_diseases = tob_disease_names, - show_progress = TRUE + show_progress = TRUE, + other_lag_function = "Cancers" + ) diff --git a/man/TobLags.Rd b/man/TobLags.Rd index ddec9b2..ae3a826 100644 --- a/man/TobLags.Rd +++ b/man/TobLags.Rd @@ -59,9 +59,13 @@ on diabetes risk occur within a few years, more similar to the CVDs than cancers and assume that the decline in risk follows the cancer estimate provided by Kontis et al., as this has the slowest decline in risk. } \examples{ - +\dontrun{ TobLags("Pharynx") +TobLags("Low_back_pain", other_lag_function = "immediate") +TobLags("Low_back_pain", other_lag_function = "CVD") +TobLags("Low_back_pain", other_lag_function = "Cancers") +} } \references{ \insertRef{Kontis2014}{tobalcepi}