diff --git a/DESCRIPTION b/DESCRIPTION index 78f0235..80d33e7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,4 +42,4 @@ Suggests: VignetteBuilder: knitr Config/testthat/edition: 3 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +Config/roxygen2/version: 8.0.0 diff --git a/R/discrmd.R b/R/discrmd.R index 22553dc..8e4eec2 100644 --- a/R/discrmd.R +++ b/R/discrmd.R @@ -45,7 +45,7 @@ #' - pd: RMD in PD state #' - os: RMD in either alive state #' @importFrom rlang .data -#' @seealso [drmd_stm_cf()] [drmd_stm_cr()] +#' @seealso [psm3mkv::drmd_stm_cf()] [psm3mkv::drmd_stm_cr()] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -91,7 +91,7 @@ drmd_psm <- function(ptdata, dpam, psmtype="simple", Ty=10, discrate=0, lifetabl #' Calculate restricted mean duration (RMD) in PF, PD and OS states under a State Transition Model Clock Forward structure. #' @inherit drmd_psm params return #' @importFrom rlang .data -#' @seealso [drmd_psm()] [drmd_stm_cr()] +#' @seealso [psm3mkv::drmd_psm()] [psm3mkv::drmd_stm_cr()] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -134,7 +134,7 @@ drmd_stm_cf <- function(dpam, Ty=10, discrate=0, lifetable=NA, timestep=1) { #' Calculate restricted mean duration (RMD) in PF, PD and OS states under a State Transition Model Clock Reset structure. #' @inherit drmd_psm params return #' @importFrom rlang .data -#' @seealso [drmd_stm_cf()] [drmd_psm()] +#' @seealso [psm3mkv::drmd_stm_cf()] [psm3mkv::drmd_psm()] #' @noRd # Examples # # Create dataset and fit survival models (splines) diff --git a/R/lhoods.R b/R/lhoods.R index 08ebe9a..9aa6b78 100644 --- a/R/lhoods.R +++ b/R/lhoods.R @@ -22,7 +22,7 @@ # ================================================================== #' Calculate likelihood for a simple three-state partitioned survival model -#' @description Calculate likelihood values and other summary output for a simple three-state partitioned survival model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [calc_likes].x three-state partitioned survival model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [calc_likes]. Unlike [calc_likes_psm_complex], this likelihood function assumes a progression hazard can be derived from the PFS hazard function and the ratio of progression to PFS events from PF patients. +#' @description Calculate likelihood values and other summary output for a simple three-state partitioned survival model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [psm3mkv::calc_likes].x three-state partitioned survival model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [psm3mkv::calc_likes]. Unlike [psm3mkv::calc_likes_psm_complex], this likelihood function assumes a progression hazard can be derived from the PFS hazard function and the ratio of progression to PFS events from PF patients. #' @param ptdata Dataset of patient level data. Must be a tibble with columns named: #' - `ptid`: patient identifier #' - `pfs.durn`: duration of PFS from baseline @@ -45,7 +45,7 @@ #' - `npts`: Number of patients analysed for each endpoint. #' - `npar`: Number of parameters used in this model. #' - `data`: A tibble of detailed likelihood calculations, where each row represents a patient. -#' @seealso [calc_likes()], [calc_likes_psm_complex()], [calc_likes_stm_cf()], [calc_likes_stm_cr()] +#' @seealso [psm3mkv::calc_likes()], [psm3mkv::calc_likes_psm_complex()], [psm3mkv::calc_likes_stm_cf()], [psm3mkv::calc_likes_stm_cr()] #' @importFrom rlang .data #' @noRd # Examples @@ -131,10 +131,10 @@ calc_likes_psm_simple <- function(ptdata, dpam, cuttime=0) { } #' Calculate likelihood for a more complex three-state partitioned survival model -#' @description Calculate likelihood values and other summary output for a more complex three-state partitioned survival model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [calc_likes()]. Unlike [calc_likes_psm_simple()], this likelihood function requires fitting to TTP. +#' @description Calculate likelihood values and other summary output for a more complex three-state partitioned survival model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [psm3mkv::calc_likes()]. Unlike [psm3mkv::calc_likes_psm_simple()], this likelihood function requires fitting to TTP. #' @inheritParams calc_likes_psm_simple #' @inherit calc_likes_psm_simple return -#' @seealso [calc_likes()], [calc_likes_psm_simple()], [calc_likes_psm_complex()], [calc_likes_stm_cr()] +#' @seealso [psm3mkv::calc_likes()], [psm3mkv::calc_likes_psm_simple()], [psm3mkv::calc_likes_psm_complex()], [psm3mkv::calc_likes_stm_cr()] #' @importFrom rlang .data #' @noRd # Examples @@ -221,7 +221,7 @@ calc_likes_psm_complex <- function(ptdata, dpam, cuttime=0) { #' @description Calculate likelihood values and other summary output for a three-state clock forward state transition model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [calc_likes]. #' @inheritParams calc_likes_psm_simple #' @inherit calc_likes_psm_simple return -#' @seealso [calc_likes()], [calc_likes_psm_simple()], [calc_likes_psm_complex()], [calc_likes_stm_cr()] +#' @seealso [psm3mkv::calc_likes()], [psm3mkv::calc_likes_psm_simple()], [psm3mkv::calc_likes_psm_complex()], [psm3mkv::calc_likes_stm_cr()] #' @importFrom rlang .data #' @noRd # Examples @@ -296,7 +296,7 @@ calc_likes_stm_cf <- function(ptdata, dpam, cuttime=0) { #' @description Calculate likelihood values and other summary output for a three-state clock reset model, given appropriately formatted patient-level data, a set of fitted survival regressions, and the time cut-off (if two-piece modeling is used). This function is called by [calc_likes]. #' @inheritParams calc_likes_psm_simple #' @inherit calc_likes_psm_simple return -#' @seealso [calc_likes()], [calc_likes_stm_cf()], [calc_likes_psm_simple()], [calc_likes_psm_complex()] +#' @seealso [psm3mkv::calc_likes()], [psm3mkv::calc_likes_stm_cf()], [psm3mkv::calc_likes_psm_simple()], [psm3mkv::calc_likes_psm_complex()] #' @importFrom rlang .data #' @noRd # Examples diff --git a/R/ltablesurv.R b/R/ltablesurv.R index d8953ea..505501c 100644 --- a/R/ltablesurv.R +++ b/R/ltablesurv.R @@ -63,7 +63,7 @@ vonelookup <- function(oneindexval, indexvec, valvec, method="geom") { #' - `ceiling`: Ceiling (maximum) value, where interpolation is required between measured values #' - `arith`: Arithmetic mean, where interpolation is required between measured values #' - `geom`: Geometric mean, where interpolation is required between measured values -#' @seealso [HMDHFDplus::readHMDweb] can be used to obtain lifetables from the Human Mortality Database +#' @seealso `HMDHFDplus::readHMDweb()` can be used to obtain lifetables from the Human Mortality Database #' @export #' @examples #' # Suppose we have survival probabilities at times 0 to 20 diff --git a/R/resmeans.R b/R/resmeans.R index 337bfb1..fc9fdba 100644 --- a/R/resmeans.R +++ b/R/resmeans.R @@ -38,7 +38,7 @@ #' @param starting Vector of membership probabilities at time zero. #' @param discrate Discount rate (%) per year #' @return Numeric value in same time unit as patient-level data (weeks). -#' @seealso Used safely as [prmd_pf_stm] by [calc_allrmds] +#' @seealso Used safely as [psm3mkv::prmd_pf_stm] by [psm3mkv::calc_allrmds] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -74,8 +74,8 @@ rmd_pf_stm <- function(dpam, Ty=10, starting=c(1, 0, 0), discrate=0) { } #' Safely calculate restricted mean duration in progression-free for state transition models -#' @description Calculates the mean duration in the progression-free state for both the state transition clock forward and clock reset models. Requires a carefully formatted list of fitted survival regressions for the necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [rmd_pf_stm]. This function is called by [calc_allrmds]. -#' @param ... Pass-through to [rmd_pf_stm] +#' @description Calculates the mean duration in the progression-free state for both the state transition clock forward and clock reset models. Requires a carefully formatted list of fitted survival regressions for the necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [psm3mkv::rmd_pf_stm]. This function is called by [psm3mkv::calc_allrmds]. +#' @param ... Pass-through to [psm3mkv::rmd_pf_stm] #' @return Numeric value in same time unit as patient-level data (weeks). #' @noRd prmd_pf_stm <- purrr::possibly(rmd_pf_stm, otherwise=NA_real_) @@ -84,8 +84,8 @@ prmd_pf_stm <- purrr::possibly(rmd_pf_stm, otherwise=NA_real_) #' @description Calculates the mean duration in the progressed disease state for the clock reset state transition model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. #' @inheritParams rmd_pf_stm #' @return Numeric value in same time unit as patient-level data (weeks). -#' @seealso [rmd_pd_stm_cr] -#' @seealso Used safely as [prmd_pd_stm_cr] by [calc_allrmds] +#' @seealso [psm3mkv::rmd_pd_stm_cr] +#' @seealso Used safely as [psm3mkv::prmd_pd_stm_cr] by [psm3mkv::calc_allrmds] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -135,8 +135,8 @@ rmd_pd_stm_cr <- function(dpam, Ty=10, starting=c(1, 0, 0), discrate=0) { } #' Safely calculate restricted mean duration in progressed disease state for clock reset state transition model -#' @description Calculates the mean duration in the progressed disease state for the clock reset state transition model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [rmd_pd_stm_cr]. This function is called by [calc_allrmds]. -#' @param ... Pass-through to [rmd_pd_stm_cr] +#' @description Calculates the mean duration in the progressed disease state for the clock reset state transition model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [psm3mkv::rmd_pd_stm_cr]. This function is called by [psm3mkv::calc_allrmds]. +#' @param ... Pass-through to [psm3mkv::rmd_pd_stm_cr] #' @return Numeric value in same time unit as patient-level data (weeks). #' @noRd prmd_pd_stm_cr <- purrr::possibly(rmd_pd_stm_cr, otherwise=NA_real_) @@ -145,7 +145,7 @@ prmd_pd_stm_cr <- purrr::possibly(rmd_pd_stm_cr, otherwise=NA_real_) #' @description Calculates the mean duration in the progressed disease state for the clock forward state transition model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. #' @inheritParams rmd_pf_stm #' @return Numeric value in same time unit as patient-level data (weeks). -#' @seealso Used safely as [prmd_pd_stm_cf] by [calc_allrmds] +#' @seealso Used safely as [psm3mkv::prmd_pd_stm_cf] by [psm3mkv::calc_allrmds] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -195,8 +195,8 @@ rmd_pd_stm_cf <- function(dpam, Ty=10, starting=c(1, 0, 0), discrate=0) { } #' Safely calculate restricted mean duration in progressed disease state for clock forward state transition model -#' @description Calculates the mean duration in the progressed disease state for the clock forward state transition model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [rmd_pd_stm_cf]. This function is called by [calc_allrmds]. -#' @param ... Pass-through to [rmd_pd_stm_cf] +#' @description Calculates the mean duration in the progressed disease state for the clock forward state transition model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [psm3mkv::rmd_pd_stm_cf]. This function is called by [psm3mkv::calc_allrmds]. +#' @param ... Pass-through to [psm3mkv::rmd_pd_stm_cf] #' @return Numeric value in same time unit as patient-level data (weeks). #' @noRd prmd_pd_stm_cf <- purrr::possibly(rmd_pd_stm_cf, otherwise=NA_real_) @@ -205,7 +205,7 @@ prmd_pd_stm_cf <- purrr::possibly(rmd_pd_stm_cf, otherwise=NA_real_) #' @description Calculates the mean duration in the progression free state for the partitioned survival model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. #' @inheritParams rmd_pf_stm #' @return Numeric value in same time unit as patient-level data (weeks). -#' @seealso Used safely as [prmd_pf_psm] by [calc_allrmds] +#' @seealso Used safely as [psm3mkv::prmd_pf_psm] by [psm3mkv::calc_allrmds] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -241,8 +241,8 @@ rmd_pf_psm <- function(dpam, Ty=10, starting=c(1, 0, 0), discrate=0) { } #' Safely calculate restricted mean duration in progression free state for the partitioned survival model -#' @description Calculates the mean duration in the progression free state for the partitioned survival model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [rmd_pf_psm]. This function is called by [calc_allrmds]. -#' @param ... Pass-through to [rmd_pf_psm] +#' @description Calculates the mean duration in the progression free state for the partitioned survival model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [psm3mkv::rmd_pf_psm]. This function is called by [psm3mkv::calc_allrmds]. +#' @param ... Pass-through to [psm3mkv::rmd_pf_psm] #' @return Numeric value in same time unit as patient-level data (weeks). #' @noRd prmd_pf_psm <- purrr::possibly(rmd_pf_psm, otherwise=NA_real_) @@ -251,7 +251,7 @@ prmd_pf_psm <- purrr::possibly(rmd_pf_psm, otherwise=NA_real_) #' @description Calculates the mean duration alive (i.e. in either progression free or progressed disease states) for the partitioned survival model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. #' @inheritParams rmd_pf_stm #' @return Numeric value in same time unit as patient-level data (weeks). -#' @seealso Used safely as [prmd_os_psm] by [calc_allrmds] +#' @seealso Used safely as [psm3mkv::prmd_os_psm] by [psm3mkv::calc_allrmds] #' @noRd # Examples # # Create dataset and fit survival models (splines) @@ -286,8 +286,8 @@ rmd_os_psm <- function(dpam, Ty=10, starting=c(1, 0, 0), discrate=0) { } #' Safely calculate restricted mean duration for overall survival in the partitioned survival model -#' @description Calculates the mean duration alive (i.e. in either progression free or progressed disease states) for the partitioned survival model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [rmd_os_psm]. This function is called by [calc_allrmds]. -#' @param ... Pass-through to [rmd_os_psm] +#' @description Calculates the mean duration alive (i.e. in either progression free or progressed disease states) for the partitioned survival model. Requires a carefully formatted list of fitted survival regressions for necessary endpoints, and the time duration to calculate over. Wrapper with 'possibly' of [psm3mkv::rmd_os_psm]. This function is called by [psm3mkv::calc_allrmds]. +#' @param ... Pass-through to [psm3mkv::rmd_os_psm] #' @return Numeric value in same time unit as patient-level data (weeks). #' @noRd prmd_os_psm <- purrr::possibly(rmd_os_psm, otherwise=NA_real_) @@ -300,7 +300,7 @@ prmd_os_psm <- purrr::possibly(rmd_os_psm, otherwise=NA_real_) #' @return A list by endpoint, then distribution, each containing two components: #' - result: A list of class *flexsurvreg* containing information about the fitted model. #' - error: Any error message returned on fitting the regression (NULL indicates no error). -#' @seealso [fit_ends_mods_par()], [fit_ends_mods_spl()] +#' @seealso [psm3mkv::fit_ends_mods_par()], [psm3mkv::fit_ends_mods_spl()] #' @noRd fit_ends_mods_given <- function(simdat, dpam, cuttime){ # Declare variables diff --git a/man/create_dummydata.Rd b/man/create_dummydata.Rd index e7b2c41..51b61e8 100644 --- a/man/create_dummydata.Rd +++ b/man/create_dummydata.Rd @@ -9,9 +9,9 @@ create_dummydata(dsname) \arguments{ \item{dsname}{Dataset name, as follows: \itemize{ -\item \code{flexbosms} provides a dataset based on \code{\link[flexsurv:bos]{flexsurv::bosms3()}}. This contains all the fields necessary for \link{psm3mkv}. Durations have been converted from months in the original dataset to weeks. +\item \code{flexbosms} provides a dataset based on \code{\link[flexsurv:bosms3]{flexsurv::bosms3()}}. This contains all the fields necessary for \link{psm3mkv}. Durations have been converted from months in the original dataset to weeks. \item \code{pharmaonc} provides a dataset based on \link[pharmaverseadam:adsl]{pharmaverseadam::adsl} and \link[pharmaverseadam:adrs_onco]{pharmaverseadam::adrs_onco} to demonstrate how this package can be used with ADaM ADTTE datasets. -\item \code{survcan} provides a dataset based on \code{\link[survival:lung]{survival::cancer()}}. This contains the necessary ID and overall survival fields only. Durations have been converted from days in the original dataset to weeks. You will additionally need to supply PFS and TTP data (fields pfs.durn, pfs.flag, ttp.durn and ttp.flag) to use \link{psm3mkv}. +\item \code{survcan} provides a dataset based on \code{\link[survival:cancer]{survival::cancer()}}. This contains the necessary ID and overall survival fields only. Durations have been converted from days in the original dataset to weeks. You will additionally need to supply PFS and TTP data (fields pfs.durn, pfs.flag, ttp.durn and ttp.flag) to use \link{psm3mkv}. }} } \value{ diff --git a/man/psm3mkv-package.Rd b/man/psm3mkv-package.Rd index a7f04c2..d156dbe 100644 --- a/man/psm3mkv-package.Rd +++ b/man/psm3mkv-package.Rd @@ -20,7 +20,12 @@ Useful links: } \author{ -\strong{Maintainer}: Dominic Muston \email{dominic.muston@merck.com} (\href{https://orcid.org/0000-0003-4876-7940}{ORCID}) +\strong{Maintainer}: Dominic Muston \email{dom.muston@gmail.com} (\href{https://orcid.org/0000-0003-4876-7940}{ORCID}) + +Authors: +\itemize{ + \item Dominic Muston \email{dom.muston@gmail.com} (\href{https://orcid.org/0000-0003-4876-7940}{ORCID}) +} Other contributors: \itemize{ diff --git a/man/vlookup.Rd b/man/vlookup.Rd index dae9a38..985f083 100644 --- a/man/vlookup.Rd +++ b/man/vlookup.Rd @@ -41,5 +41,5 @@ vlookup(c(7, 7.5), times, survival) # observed survival values at times 7 and 8. } \seealso{ -\link[HMDHFDplus:readHMDweb]{HMDHFDplus::readHMDweb} can be used to obtain lifetables from the Human Mortality Database +\code{HMDHFDplus::readHMDweb()} can be used to obtain lifetables from the Human Mortality Database }