Package 'dMrs'

Title: Competing Risk in Dependent Net Survival Analysis
Description: Provides statistical tools for analyzing net and relative survival, with a key feature of relaxing the assumption of independent censoring and incorporating the effect of dependent competing risks. It employs a copula-based methodology, specifically the Archimedean copula, to simulate data, conduct survival analysis, and offer comparisons with other methods. This approach is detailed in the work of Adatorwovor et al. (2022) <doi:10.1515/ijb-2021-0016>.
Authors: Reuben Adatorwovor [aut], Paul Little [cre]
Maintainer: Paul Little <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2025-01-21 17:32:57 UTC
Source: CRAN

Help Index


opt_sum

Description

Summarizes the solutions post-optimization

Usage

opt_sum(OPT)

Arguments

OPT

Output list from run_analyses()

Value

A dataframe containing a summary of each successfully optimized configuration of copula and density with corresponding constrained maximum likelihood estimates, and Bayesian Information Criteria.


plot_SURVs

Description

Plot net survival probabilities per model

Usage

plot_SURVs(run_ANA, MULTIPLE, ncol = 1, ALPHA = 0.5)

Arguments

run_ANA

The object outputted from run_analyses function.

MULTIPLE

A boolean set to TRUE to display a survival plot per theta with accompanying maximum log likelihood. Otherwise, the survival plots will be overlayed with a legend.

ncol

Integer number of columns of plots to display

ALPHA

A numeric value between 0 and 1 to control the confidence band transparency.

Value

Returns a ggplot object of survival predictions and corresponding confidence intervals, Bayesian Information Criteria, maximum likelihood estimates. The user may apply their own customized graphic edits prior to visualizing the final graphic with the print() function.


refData_match

Description

This function takes as input a working dataset of interest and a reference dataset.

Usage

refData_match(wDAT, rDAT, ncores = 1)

Arguments

wDAT

A working dataset data.frame containing required columns age, time, datediag_yr, and sex corresponding to age, observed time (in years), diagnosis year, and sex (coded 'female'/'male'), respectively.

rDAT

A reference dataset data.frame containing required columns year, age, qx, and sex corresponding to reference year, reference age, event's interval hazard, and sex, respectively.

ncores

Integer number of parallel threads to decrease matching runtime.

Value

A dataframe containing calculated log-transformed density and log-transformed cumulative distribution


run_analyses

Description

This function performs a full analysis of an inputted dataframe. The user may specify one of two copulas, a theta value, a parametric grid to search over, and a vector of times for predicting survival.

Usage

run_analyses(
  DATA,
  THETAs = NULL,
  upKAPPA,
  gTHRES = 0.1,
  COPULAS,
  param_grid,
  vec_time,
  ncores = 1,
  max_iter = 200,
  verb,
  PLOT
)

Arguments

DATA

A data.frame containing column names time (in years), delta (event indicator), log_dens_t2 (log-transformed population-based density), and log_cdf_t2 (log-transformed population-based cumulative density).

THETAs

A vector of theta values to explore and optimize over.

upKAPPA

An integer value taking values 0 or 1. If set to 1, the exponentiated Weibull distribution is assumed. Otherwise, the Weibull distribution is assumed and optimized over. If undefined, the optimization will search over both distributions.

gTHRES

A numeric threshold on the L2 norm of the gradient evaluated at the MLE.

COPULAS

If undefined, will optimize over all copulas. Otherwise set to 'Independent', 'Clayton' or 'Gumbel'

param_grid

Vector of values spanning possible log(alpha1), log(lambda1), log(kappa1), unconstrained theta parameters

vec_time

Vector of times in years to calculate predicted survival.

ncores

A positive integer for the number of threads to evaluate log-likelihoods across the parameter grid.

max_iter

Maximum Newton Raphson and Gradient Descent iterations to set.

verb

Boolean value to display verbose information or not

PLOT

A logical variable, set to TRUE by default to show the two-dimensional heatmap of the profile likelihood if verb = TRUE.

Value

Returns a parsable list of results per successfully optimized configuration of copula and density with accompanying net survival predictions, survival confidence intervals, maximum likelihood estimates, MLE confidence intervals (constrained and unconstrained), Bayesian Information Criteria for model selection, and extra statistical metrics to confirm convergence.