Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions R/discrmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions R/lhoods.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/ltablesurv.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions R/resmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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_)
Expand All @@ -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)
Expand Down Expand Up @@ -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_)
Expand All @@ -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)
Expand Down Expand Up @@ -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_)
Expand All @@ -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)
Expand Down Expand Up @@ -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_)
Expand All @@ -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)
Expand Down Expand Up @@ -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_)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions man/create_dummydata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/psm3mkv-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/vlookup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading