| plot.tp.survtmle | R Documentation | 
Step function plots for both raw and smoothed (monotonic) estimates, the latter by isotonic regression of the raw estimates, of cumulative incidence.
## S3 method for class 'tp.survtmle'
plot(
  x,
  ...,
  incidence = TRUE,
  type = c("iso", "raw"),
  pal = ggsci::scale_color_lancet()
)
x | 
 object of class   | 
... | 
 additional arguments passed   | 
incidence | 
 
  | 
type | 
 
  | 
pal | 
 A   | 
object of class ggplot containing a step function plot of the
raw or smoothened point estimates of cumulative incidence across a series
of timepoints of interest.
library(survtmle)
set.seed(341796)
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)
suppressWarnings(
  fit <- survtmle(
    ftime = ftime, ftype = ftype,
    adjustVars = W, glm.ftime = "I(W1*W2) + trt + t",
    trt = A, glm.ctime = "W1 + t", method = "hazard",
    verbose = TRUE, t0 = t_0, maxIter = 2
  )
)
tpfit <- timepoints(fit, times = seq_len(t_0))
plot(tpfit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.