Learn R Programming

lmtp (version 1.5.0)

lmtp_survival: LMTP Survival Curve Estimator

Description

Wrapper around lmtp_tmle and lmtp_sdr for survival outcomes to estimate the entire survival curve. Estimates are reconstructed using isotonic regression to enforce monotonicity of the survival curve. Confidence intervals correspond to marginal confidence intervals for the survival curve, not simultaneous intervals.

Usage

lmtp_survival(
  data,
  trt,
  outcomes,
  baseline = NULL,
  time_vary = NULL,
  cens = NULL,
  compete = NULL,
  shift = NULL,
  shifted = NULL,
  estimator = c("lmtp_tmle", "lmtp_sdr"),
  k = Inf,
  mtp = FALSE,
  id = NULL,
  learners_outcome = "SL.glm",
  learners_trt = "SL.glm",
  folds = 10,
  weights = NULL,
  control = lmtp_control()
)

Value

A list of class lmtp_survival containing lmtp objects for each time point.

Arguments

data

[data.frame]
A data.frame in wide format containing all necessary variables for the estimation problem. Must not be a data.table.

trt

[character] or [list]
A vector containing the column names of treatment variables ordered by time. Or, a list of vectors, the same length as the number of time points of observation. Vectors should contain column names for the treatment variables at each time point. The list should be ordered following the time ordering of the model.

outcomes

[character]
A vector containing the columns names of intermediate outcome variables and the final outcome variable ordered by time. Only numeric values are allowed. Variables should be coded as 0 and 1.

baseline

[character]
An optional vector containing the column names of baseline covariates to be included for adjustment at every time point.

time_vary

[list]
A list the same length as the number of time points of observation with the column names for new time-varying covariates introduced at each time point. The list should be ordered following the time ordering of the model.

cens

[character]
An optional vector of column names of censoring indicators the same length as the number of time points of observation. If missingness in the outcome is present or if time-to-event outcome, must be provided.

compete

[character]
An optional vector of column names of competing risk indicators the same length as the number of time points of observation.

shift

[closure]
A two argument function that specifies how treatment variables should be shifted. See examples for how to specify shift functions for continuous, binary, and categorical exposures.

shifted

[data.frame]
An optional data frame, the same as in data, but modified according to the treatment policy of interest. If specified, shift is ignored.

estimator

[character(1)]
The estimator to use. Either "lmtp_tmle" or "lmtp_sdr".

k

[integer(1)]
An integer specifying how previous time points should be used for estimation at the given time point. Default is Inf, all time points.

mtp

[logical(1)]
Is the intervention of interest a modified treatment policy? Default is FALSE. If treatment variables are continuous this should be TRUE.

id

[character(1)]
An optional column name containing cluster level identifiers.

learners_outcome

[character]
A vector of SuperLearner algorithms for estimation of the outcome regression. Default is "SL.glm", a main effects GLM.

learners_trt

[character]
A vector of SuperLearner algorithms for estimation of the exposure mechanism. Default is "SL.glm", a main effects GLM. Only include candidate learners capable of binary classification.

folds

[integer(1)]
The number of folds to be used for cross-fitting.

weights

[numeric(nrow(data))]
An optional vector containing sampling weights.

control

[list()]
Output of lmtp_control().

Examples

Run this code
# \donttest{
# Example 1.1
# Time-to-event analysis with a binary time-invariant exposure. Interested in
# the effect of treatment being given to all observations on the cumulative
# incidence of the outcome.
A <- "trt"
Y <- paste0("Y.", 1:6)
C <- paste0("C.", 0:5)
W <- c("W1", "W2")

curve <- lmtp_survival(sim_point_surv, A, Y, W, cens = C, folds = 1,
                       shift = static_binary_on, estimator = "lmtp_tmle")

tidy(curve)

# Example 1.2
# Time-to-event analysis with a binary time-invariant exposure and a competing-risk.
lmtp_survival(
  data = sim_competing_risks,
  trt = "A",
  cens = paste0("C", 1:5),
  compete = paste0("D", 1:5),
  baseline = paste0("W", 1:5),
  outcome = paste0("Y", 1:5),
  shift = static_binary_on,
  folds = 1
)
# }

Run the code above in your browser using DataLab