Package: TwoTimeScales 1.2.1

TwoTimeScales: Analysis of Event Data with Two Time Scales

Analyse time to event data with two time scales by estimating a smooth hazard that varies over two time scales. If covariates are available, estimate a proportional hazards model with such a two-dimensional baseline hazard. Functions are provided to prepare the raw data for estimation, to fit the model and to plot the two-dimensional smooth hazard. Extension to a competing risks model are implemented. For details about the method please refer to Carollo et al. (2025) <doi:10.1002/sim.10297>.

Authors:Angela Carollo [aut, cre, cph], Paul H.C. Eilers [aut], Jutta Gampe [aut]

TwoTimeScales_1.2.1.tar.gz
TwoTimeScales_1.2.1.zip(r-4.7)TwoTimeScales_1.2.1.zip(r-4.6)TwoTimeScales_1.2.1.zip(r-4.5)
TwoTimeScales_1.2.1.tgz(r-4.6-any)TwoTimeScales_1.2.1.tgz(r-4.5-any)
TwoTimeScales_1.2.1.tar.gz(r-4.7-any)TwoTimeScales_1.2.1.tar.gz(r-4.6-any)
TwoTimeScales_1.2.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
TwoTimeScales/json (API)

# Install 'TwoTimeScales' in R:
install.packages('TwoTimeScales', repos = c('https://angelacar.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/angelacar/twotimescales/issues

Pkgdown/docs site:https://angelacar.github.io

Datasets:
  • reccolon2ts - Data from the chemotherapy for stace B/C colon cancer study

On CRAN:

Conda:

6.11 score 13 stars 5 scripts 451 downloads 30 exports 74 dependencies

Last updated from:ca84097384. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK279
source / vignettesOK266
linux-release-x86_64OK286
macos-release-arm64OK198
macos-oldrel-arm64OK298
windows-develOK168
windows-releaseOK140
windows-oldrelOK162
wasm-releaseOK160

Exports:boot_cuminc2tscovariates_plotcumhaz2tscuminc2tsexposures_events_1dexposures_events_2dexposures_events_Lexisfit1tsfit2tsfitpgamfitvcmget_hazard_1dget_hazard_1d_LMMget_hazard_2dget_hazard_2d_LMMget_hrhaz2ts_summaryhaz2tsLMM_summaryhaz2tsPGAM_summaryhaz2tsVCM_summarymake_binsmake_gridplot_boot_cuminc2tspredict_cif2ts_pointwisepredict_comprisks2tspredict_haz2tspredict_haz2ts_pointwiseprepare_dataselect_model2tssurv2ts

Dependencies:ashbitopsbootcliclustercmprskcolorspacecpp11data.tabledotCall64dplyrEpietmfarverfdsfieldsFNNgenericsggplot2gluegridExtragtablehdrcdeisobandJOPSkernlabKernSmoothkslabelinglatticelifecycleLMMsolverlocfitmagrittrmapsMASSMatrixmclustmgcvmulticoolmvtnormnlmenumDerivpcaPPpillarpkgconfigplyrpopEpipracmaR6rainbowRColorBrewerRcppRcppArmadilloRCurlreshape2rlangrpartS7scalesspamSpATSstringistringrsurvivaltibbletidyselectucminfutf8vctrsviridisviridisLitewithrzoo

Introduction to TwoTimeScales
Data: reccolon2ts | Step 1: data preparation | One time scale only | Two time scales | Including covariates | Step 2: Estimation | One time scale | Step 3: Visualize the results | References

Last update: 2026-06-30
Started: 2024-04-25

Smooth hazards with one time scale
Data preparation | Estimation | Presenting the results of the smooth one time scale hazard model | References

Last update: 2026-06-30
Started: 2024-04-25

Smooth hazards with two time scales
Introduction | Hazard of death by time since randomization and time since recurrence | PH regression for the colon cancer data | Prepare the data over the Lexis diagram

Last update: 2026-06-30
Started: 2024-04-25

Visualize hazards with two time scales
Introduction | The function plot() | Baseline hazard and log-hazard | Plot on the $(t,s)$-plane | Evaluate the $B$-splines on a finer grid | Plot the log-hazard | Plot the log10-hazard | Cut extrapolated hazard | Change color palette and color of the contour lines | Standard Errors surface | Cross-sections of the hazard | Survival function | Cumulative hazard

Last update: 2026-06-30
Started: 2024-04-25

Readme and manuals

Help Manual

Help pageTopics
Bootstrap confidence intervals for cumulative incidence functions with two time scalesboot_cuminc2ts
Plot of the covariates' effectscovariates_plot
Cumulative hazard over two time scalescumhaz2ts
Cumulative incidence surface over two time scalescuminc2ts
Bin data on one time scaleexposures_events_1d
Bin data on two time scalesexposures_events_2d
Bin data on the Lexis diagramexposures_events_Lexis
Fit a smooth hazard model with one time scalefit1ts
Fit a smooth hazard model with two time scalesfit2ts
Fit a log-additive model over two time scalesfitpgam
Fit a Varying Coefficient Model (VCM) over two time scalesfitvcm
Get estimated (log-)hazard values with 1 time scaleget_hazard_1d
Get estimated (log-)hazard values with 1 time scaleget_hazard_1d_LMM
Get estimated (log-)hazard surface with 2 time scalesget_hazard_2d
Get estimated (log-)hazard surface with 2 time scalesget_hazard_2d_LMM
Get the Hazard Ratios with their Standard Errorsget_hr
Summary function for object of class 'haz2ts'haz2ts_summary
Summary function for object of class 'haz2tsLMM'haz2tsLMM_summary
Summary function for object of class 'haz2tsPGAM'haz2tsPGAM_summary
Summary function for object of class 'haz2tsVCM'haz2tsVCM_summary
Image Plot of 2ts hazardimageplot_2ts
Image Plot of Standard Errors for the 2ts hazardimageplot_SE
Construct bins over one or more time axesmake_bins
Make a grid of points to evaluate B-splinesmake_grid
Image Plot of Bootstrap Uncertainty for Cumulative Incidence Functionsplot_boot_cuminc2ts
Plot slices of the (log-) hazardplot_slices
Plot method for a haz1ts object.plot.haz1ts
Plot method for a haz1ts object.plot.haz1tsLMM
Plot method for a haz2ts object.plot.haz2ts
Plot method for a haz2tsLMM object.plot.haz2tsLMM
Plot method for a haz2tsPGAM object.plot.haz2tsPGAM
Plot method for a haz2tsVCM object.plot.haz2tsVCM
Point-wise prediction of cumulative incidence over 2 time scalepredict_cif2ts_pointwise
Predict overall survival and cumulative incidence functionspredict_comprisks2ts
Prediction method for objects of class ''haz2ts''predict_haz2ts
Point-wise prediction hazard 2 time scalepredict_haz2ts_pointwise
Prepare raw data by binning them in 1d or 2dprepare_data
Process data to fit model with LMMsolverprepare_data_LMMsolver
Print method for a 'data2ts' objectprint.data2ts
Data from the chemotherapy for stace B/C colon cancer studyreccolon2ts
Selects best model among a group of fitted modelsselect_model2ts
Survival function with two time scalessurv2ts