Description Usage Arguments Value Examples
Wrapper function for survtmle
that takes a fitted survtmle
object and computes the TMLE estimated incidence for all times specified in
the times
argument. For this function to work, the original call to
survtmle
should have been executed with returnModels = TRUE
.
This allows the function to be more efficient than repeated calls to
survtmle
in that timepoints
will use fitted censoring (and
hazard if method="hazard"
was used in the original call) estimates. It
is therefore advisable that the vector times
used in the call to
timepoints
not include times beyond the time specified in t0
in
the original call to survtmle
. This can be ensured be making the
original call to survtmle
with t0 = max(ftime)
.
1 | timepoints(object, times, returnModels = FALSE)
|
object |
A fitted |
times |
The times to evaluate incidence. |
returnModels |
Should the function return fitted GLM or Super Learner
models at each timepoint. If set to |
An object of class tp.survtmle
with number of entries equal to
length(times)
. Each entry is named "tX", where X denotes a
single value of times
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # simulate data
set.seed(1234)
n <- 100
ftime <- round(runif(n, 1, 4))
ftype <- round(runif(n, 0, 2))
trt <- rbinom(n, 1, 0.5)
adjustVars <- data.frame(W1 = rnorm(n), W2 = rnorm(n))
# fit an initial survtmle object with t0=max(ftime)
fm <- survtmle(ftime = ftime, ftype = ftype,
trt = trt, adjustVars = adjustVars,
glm.trt = "1", glm.ftime = "trt + W1 + W2",
glm.ctime = "trt + W1 + W2", method="mean",
returnModels = TRUE)
# call timepoints to get cumulative incidence estimates at each timepoint
allTimes <- timepoints(object = fm, times = 1:4, returnModels = FALSE)
# look at results for time 1
class(allTimes$t1)
allTimes$t1
# look at results for time 2
allTimes$t2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.