MyNixOS website logo
Description

Competing Risks Models for Multi-Center Survival Data with Frailty.

Implements methods for analyzing competing risks data in multi-center survival studies using frailty models. The approach relies on a mixed proportional hazards model for the sub-distribution, allowing for cluster-specific random effects. The package provides tools for model estimation with or without frailty using Maximum Likelihood (ML) and Restricted Maximum Likelihood (REML). It supports flexible modeling of between-center heterogeneity and is particularly suited for multi-center clinical trials or registries. Core features include data simulation, likelihood computation, cluster-dependent censoring options, and testing of frailty effects. For methodological details, see Katsahian et al. (2006) <doi:10.1002/sim.2684>.

FrailtyCompRisk

CRANstatus R-CMD-check License:GPLv3

📚 Overview

The goal of FrailtyCompRisk is to provide tools for competing risks survival analysis in multicenter studies, accounting for unobserved heterogeneity (frailty) at the center level as proposed in the following article:

Katsahian S, Resche-Rigon M, Chevret S, Porcher R. Analysing multicentre competing risks data with a mixed proportional hazards model for the subdistribution. Stat Med. 2006 Dec 30;25(24):4267-78. doi: 10.1002/sim.2684. PMID: 16960919.

This package is particularly useful for statisticians and epidemiologists analyzing time-to-event data where individuals are nested within centers (e.g., hospitals or clinics), and where multiple causes of failure may occur.

It includes functions to: - Simulate clustered competing risks data, - Fit cause-specific Cox models with shared frailty, following the method presented by Sandrine Katsahian in "Analysing multicentre competing risks data with a mixed proportional hazards model for the subdistribution." - Fit cause-specific Cox models, - Fit Cox models with shared frailty, - Fit Cox models.

The REML method is used when shared frailty is modeled; otherwise, the ML method is applied.

Results

We conducted the same simulation-based tests as in "Analysing multicentre competing risks data with a mixed proportional hazards model for the subdistribution.", and we obtained similar results:

NKθθ̂MSE(θ̂)γγ̂MSE(γ̂)
20050.00.0240.00244(0)(-0.068)(0.23858)
200200.00.0550.01027(0)(0.06)(0.34056)
50050.00.0120.00062(0)(-0.001)(0.10598)
500200.00.0200.00137(0)(0.004)(0.0921)
20050.00.0360.00690(0.375)(0.345)(0.23996)
200200.00.0540.01221(0.375)(0.381)(0.29773)
50050.00.0120.00068(0.375)(0.354)(0.10479)
500200.00.0200.00161(0.375)(0.42)(0.10242)
20050.10.1300.03940(0)(-0.069)(0.25903)
200200.10.1270.02099(0)(-0.025)(0.31313)
50050.10.1080.01366(0)(-0.013)(0.0985)
500200.10.1060.00754(0)(-0.056)(0.10335)
20050.10.1270.02148(0.375)(0.372)(0.26376)
200200.10.1390.02608(0.375)(0.365)(0.27877)
50050.10.1110.01158(0.375)(0.378)(0.10493)
500200.10.0990.00713(0.375)(0.377)(0.10856)
20050.60.6550.43517(0)(0.035)(0.22487)
200200.60.5410.11904(0)(-0.009)(0.35059)
50050.60.6110.29234(0)(0.001)(0.10746)
500200.60.5980.06516(0)(0.004)(0.10813)
20050.60.6490.41894(0.375)(0.398)(0.2656)
200200.60.5700.11168(0.375)(0.378)(0.25024)
50050.60.6290.30846(0.375)(0.381)(0.10446)
500200.60.5690.07018(0.375)(0.38)(0.09621)

📦 Installation

You can install the development version of FrailtyCompRisk from GitHub using either pak or devtools:

# Using pak (recommended)
# install.packages("pak")
pak::pak("TeamHeKA/FrailtyCompRisk")

# Or using devtools
# install.packages("devtools")
devtools::install_github("TeamHeKA/FrailtyCompRisk")

📌 Usage

🧪 Data simulation

You can generate simple datasets following the competing risks model with center effect frailty with the code below :

library(FrailtyCompRisk)

## SIZE AND CENTER REPARTITION
n_per_cluster=20 #sample size of each center
n_cluster=5 #number of centers
n=n_per_cluster * n_cluster #sample size
G=rep(1:n_cluster, each = n_per_cluster) #center repartition

## COVARIATES AND COMPETING FAILURE TIMES
n_cov=5 #number of covariables
Z=matrix(rnorm(n*n_cov,0,1),ncol = n_cov) #standardized Gaussian covariables 
prop=0.6 #proportion of failure 1
beta=c(1,1.2,0,-0.5,-0.2) #effects of covariates on failure cause 1
theta=0.6 #Variance of center effect frailty

## CENSORING
cens=TRUE #censoring in the simaluted data
pcens=0.25 #proportion of censoring
tau=1 #Variance of center effect on censoring

## DATA SIMULATION
data<-simulate_data(G,Z,prop,beta,theta,cens,pcens,tau)

📈 Parameters estimation

You can estimate the parameters of the model by using the function Parameters_estimation.

You must specify the method: - Competing risks with shared frailty for cause 1 ("CompRisk_frailty") - Competing risks without frailty for cause 1 ("CompRisk") - Standard Cox model with shared frailty ("Cox_frailty") - Standard Cox model without frailty ("Cox")

You must submit a data frame with at least 3 columns: - times: the observed time, - status: 0 for right-censoring, i in [1,n] otherwise, where i is the cause of failure, - clusters: cluster/group indicator. If there is no cluster, clusters=rep(1,n), with n the size sample.

You also have to specify whether you want to take into account for a center effect on censoring (cluster_censoring), if you chose method = "CompRisk_frailty". You may also specify a threshold of convergence, a threshold for the variance of center effect frailty (in the case it tends to zero and it might be negligible, hence the threshold) and a maximum number of iterations.

method="CompRisk_frailty" #specify the method needed
cluster_censoring=F #center effect on censoring
max_iter=300 #maximum number of iterations
tol=1e-6 #threshold of convergence
threshold=1e-6 #threshold for the variance of center effect frailty

results <- Parameters_estimation(data,method,cluster_censoring,max_iter,tol,threshold)

results$beta #estimation of effects of covariates on failure cause 1
results$theta #(only for method "CompRisk_frailty" and "Cox_frailty") estimation of the variance of center effect frailty
results$u #(only for method "CompRisk_frailty" and "Cox_frailty") estimation of center effect frailty
results$p_value #(only for method "CompRisk_frailty" and "Cox_frailty") p_value for the test theta = 0, if p>0.05 or p is NA, it suggests that the cluster effect may be negligible.

Complexity

The complexity of this algorithm is O(N² + Np + NK + (p + K)³)

where: - N: sample size - T: the number of iterations made, T < max_iter, where max_iter is a parameter you can choose - p: the number of covariables - K: the number of clusters

This package uses sparse matrices with the package Matrix, which improve significantly the speed of the algorithms.

🧠 Example on real data

This is under development...

📬 Contact

For any questions, issues, or suggestions, please open an issue on GitHub.

🙏 Acknowledgments

Thanks to Lucas Ducrot and Benjamin Delmas for their contribution.

🧩 References

The Matrix package.

If you use this package in your research, please cite the following article:

Katsahian S, Resche-Rigon M, Chevret S, Porcher R. Analysing multicentre competing risks data with a mixed proportional hazards model for the subdistribution. Stat Med. 2006 Dec 30;25(24):4267-78. doi: 10.1002/sim.2684. PMID: 16960919.

Metadata

Version

0.1.1

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows