knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

R/survtmle

Travis-CI Build Status AppVeyor Build  Status Coverage Status CRAN CRAN downloads Project Status: Active – The project has reached a stable, usable state and is being actively developed. MIT license DOI

Targeted Minimum Loss-Based Estimation (TMLE) for Survival Analysis with Competing Risks

Authors: David Benkeser and Nima Hejazi


Description

survtmle is an R package designed to use targeted minimum loss-based estimation (TMLE) to compute covariate-adjusted marginal cumulative incidence estimates in right-censored survival settings with and without competing risks. The estimates can leverage ensemble machine learning via the SuperLearner package.


Installation

For standard use, we recommend installing the package from CRAN via

install.packages("survtmle")

You can install a stable release of survtmle from GitHub via devtools with:

devtools::install_github("benkeser/survtmle")

Issues

If you encounter any bugs or have any specific feature requests, please file an issue.


Example

This minimal example shows how to use survtmle to obtain cumulative incidence estimates with a very simple, simulated data set.

# load the package and set seed for reproducibility
library(survtmle)
set.seed(341796)

# simulate data
n <- 100
t_0 <- 10
W <- data.frame(W1 = runif(n), W2 = rbinom(n, 1, 0.5))
A <- rbinom(n, 1, 0.5)
T <- rgeom(n,plogis(-4 + W$W1 * W$W2 - A)) + 1
C <- rgeom(n, plogis(-6 + W$W1)) + 1
ftime <- pmin(T, C)
ftype <- as.numeric(ftime == T)

# apply survtmle for estimation
fit <- survtmle(ftime = ftime, ftype = ftype,
                trt = A, adjustVars = W,
                glm.trt = "1",
                glm.ftime = "I(W1*W2) + trt + t",
                glm.ctime = "W1 + t",
                method = "hazard",
                t0 = t_0)

# extract cumulative incidence at each timepoint
tpfit <- timepoints(fit, times = seq_len(t_0))

# examine output object produced by the timepoints function
tpfit

# examine plot of cumulative incidences
plot(tpfit)

Contributions

Contributions are very welcome. Interested contributors can consult our contribution guidelines prior to submitting a pull request.


Citation

After using the survtmle R package, please cite both of the following:

    @manual{benkeser2017survtmle,
      author = {Benkeser, David C and Hejazi, Nima S},
      title = {{survtmle}: Targeted Minimum Loss-Based Estimation for
               Survival Analysis in {R}},
      year  = {2017},
      howpublished = {\url{https://github.com/benkeser/survtmle}},
      url = {http://dx.doi.org/10.5281/zenodo.835868},
      doi = {10.5281/zenodo.835868}
    }

    @article{benkeser2017improved,
      author = {Benkeser, David C and Carone, Marco and Gilbert, Peter B},
      title = {Improved estimation of the cumulative incidence of rare
               outcomes},
      journal = {Statistics in Medicine},
      publisher = {Wiley-Blackwell},
      year  = {2017},
      doi = {10.1002/sim.7337}
    }

License

© 2016-2019 David C. Benkeser

The contents of this repository are distributed under the MIT license. See below for details:

The MIT License (MIT)

Copyright (c) 2016-2019 David C. Benkeser

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


benkeser/survtmle documentation built on Nov. 23, 2023, 4:45 a.m.