surv_onestep_difference: One-step TMLE estimator for survival curve

Description Usage Arguments Details Value Examples

View source: R/1_surv_onestep.R

Description

one-step TMLE estimate of the difference of treatment-specific survival curves (S_1(t) - S_0(t)). Under right-censored data

Usage

1
2
3
4
5
surv_onestep_difference(dat, dW = rep(1, nrow(dat)), g.SL.Lib = c("SL.glm",
  "SL.step", "SL.glm.interaction"), Delta.SL.Lib = c("SL.mean", "SL.glm",
  "SL.gam", "SL.earth"), ht.SL.Lib = c("SL.mean", "SL.glm", "SL.gam",
  "SL.earth"), epsilon.step = 1e-05, max.iter = 1000, tol = 1/nrow(dat),
  T.cutoff = NULL, verbose = TRUE, ...)

Arguments

dat

A data.frame with columns T.tilde, delta, A, W. T.tilde = min(T, C) is either the failure time of censor time, whichever happens first. 'delta'= I(T <= C) is the indicator of whether we observe failure time. A is binary treatment. W is baseline covariates. All columns with character "W" will be treated as baseline covariates.

dW

A binary vector specifying dynamic treatment (as a function output of W)

g.SL.Lib

A vector of string. SuperLearner library for fitting treatment regression

Delta.SL.Lib

A vector of string. SuperLearner library for fitting censoring regression

ht.SL.Lib

A vector of string. SuperLearner library for fitting conditional hazard regression

epsilon.step

numeric. step size for one-step recursion

max.iter

integer. maximal number of recursion for one-step

tol

numeric. tolerance for optimization

T.cutoff

int. Enforce randomized right-censoring to the observed data, so that don't estimate survival curve beyond a time point. Useful when time horizon is long.

verbose

boolean. When TRUE, plot the initial fit curve, and output the objective function value during optimzation

...

additional options for plotting initial fit curve

Details

options to ADD: SL.formula: the covariates to include in SL

Value

Psi.hat A numeric vector of estimated treatment-specific survival curve

T.uniq A vector of descrete time points where Psi.hat take values (have same length as Psi.hat)

params A list of estimation parameters set by user

variables A list of data summary statistics

initial_fit A list of initial fit values (hazard, g_1, Delta)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(simcausal)
D <- DAG.empty()

D <- D +
    node("W", distr = "rbinom", size = 1, prob = .5) +
    node("A", distr = "rbinom", size = 1, prob = .15 + .5*W) +
    node("Trexp", distr = "rexp", rate = 1 + .5*W - .5*A) +
    node("Cweib", distr = "rweibull", shape = .7 - .2*W, scale = 1) +
    node("T", distr = "rconst", const = round(Trexp*100,0)) +
    node("C", distr = "rconst", const = round(Cweib*100, 0)) +
    node("T.tilde", distr = "rconst", const = ifelse(T <= C , T, C)) +
    node("delta", distr = "rconst", const = ifelse(T <= C , 1, 0))
setD <- set.DAG(D)

dat <- sim(setD, n=3e2)

library(dplyr)
# only grab ID, W's, A, T.tilde, Delta
Wname <- grep('W', colnames(dat), value = TRUE)
dat <- dat[,c('ID', Wname, 'A', "T.tilde", "delta")]

dW <- rep(1, nrow(dat))
onestepfit <- surv_onestep_difference(dat = dat,
                                       dW = dW,
                                       verbose = FALSE,
                                       epsilon.step = 1e-3,
                                       max.iter = 1e3)

wilsoncai1992/onestep.survival documentation built on Dec. 17, 2017, 12:07 p.m.