Skip to content

helenecharlotte/continuousTMLE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Continuous-time TMLE

Overview

Overview of code

Current implementation:

For simulation study:

TMLE for survival analysis

Simulated data examples

All data contain three continuous covariates, L_1, L_2, L_3, a binary treatment, A, a time-to-event variable, time, and an event indicator, delta.

Setting 1

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(dt1 <- sim.data2(500, setting=1, m=101))   
      id      time delta A          L1         L2          L3
  1:   1 2.0631444     1 0  0.49139281 -0.6688724 0.291922718
  2:   2 2.1493063     1 0 -0.73285336  0.5850001 0.500198228
  3:   3 1.4273563     1 0 -0.14371713  0.5780268 0.445078787
  4:   4 0.4280762     1 1 -0.26399351 -0.3642358 0.450386852
  5:   5 0.8844077     1 0 -0.38961309  0.3991256 0.867301825
 ---                                                         
496: 496 0.2453018     1 1  0.22407892  0.9891128 0.980549826
497: 497 1.4340098     1 0  0.11135457 -0.7108160 0.006933557
498: 498 1.8405661     1 1 -0.91630937 -0.9992122 0.391603182
499: 499 0.7440901     0 1 -0.45349936 -0.6978073 0.435121550
500: 500 0.6051863     1 1 -0.01772394  0.5169929 0.821363185

Setting 2

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(dt2 <- sim.data2(500, setting=2, m=30033))   
      id      time delta A           L1         L2        L3
  1:   1 0.9471819     1 0  0.756822031 0.77002296 0.7797066
  2:   2 1.1323334     1 0 -0.065353703 0.35827118 0.7976352
  3:   3 1.7053282     1 1  0.656070347 0.20709002 0.5780152
  4:   4 0.8061263     1 1 -0.763604288 0.40173444 0.6358432
  5:   5 0.8088335     1 1  0.875432958 0.01411658 0.9980470
 ---                                                        
496: 496 0.7946299     1 1 -0.946018820 0.47053691 0.4194170
497: 497 0.8807391     1 0 -0.648760873 0.84350969 0.8831198
498: 498 1.2373449     1 1 -0.334965690 0.05032776 0.3214108
499: 499 0.7937388     1 1 -0.006926148 0.63071498 0.7458795
500: 500 0.1190475     1 0  0.820146986 0.84440805 0.5426060

Back to top

Examples of applying the code to simulated data

Targeting time-specific and treatment-specific survival probabilities

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run0 <- contmle(dt1, #-- dataset
                 treat.effect="0", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("survival"=list(fit="cox", 
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1)                                         
                                 )
                 ))     
$init
            tau=0.5
init.est 0.08273712
init.se  0.01390123

$tmle
            tau=0.5
tmle.est 0.04657883
tmle.se  0.01377620
$init
            tau=0.5
init.est 0.08909946
init.se  0.01660139

$tmle
            tau=0.5
tmle.est 0.06933829
tmle.se  0.01657499
# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run1 <- contmle(dt1, #-- dataset
                 treat.effect="1", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("survival"=list(fit="cox", 
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1)                                         
                                 ) 
                 ))   
$init
            tau=0.5
init.est 0.08203692
init.se  0.02045089

$tmle
            tau=0.5
tmle.est 0.11721628
tmle.se  0.02041782
$init
            tau=0.5
init.est 0.07562680
init.se  0.01850529

$tmle
            tau=0.5
tmle.est 0.09682654
tmle.se  0.01847456

Back to top

Targeting the time-specific average treatment effect (ATE) on survival

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run2 <- contmle(dt1, #-- dataset
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("survival"=list(fit="cox", 
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1)                                         
                                 )
                 ))   
$init
               tau=0.5
init.est -0.0007001979
init.se   0.0246345062

$tmle
            tau=0.5
tmle.est 0.07052852
tmle.se  0.02469477
$init
             tau=0.5
init.est -0.01347265
init.se   0.02472451

$tmle
            tau=0.5
tmle.est 0.02748492
tmle.se  0.02472948

Back to top

Targeting survival probabilities simultaneously across multiple time-points

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run3 <- contmle(dt1, #-- dataset
                 treat.effect="ate", #-- target the ate directly
                 tau=c(0.3, 0.5), #-- time-point of interest
                 estimation=list("survival"=list(fit="cox",  
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1)                                         
                                 )
                 ))   
$init
              tau=0.3       tau=0.5
init.est -0.000366087 -0.0007001979
init.se   0.017949756  0.0246345062

$tmle
            tau=0.3    tau=0.5
tmle.est 0.04027219 0.07067547
tmle.se  0.01798117 0.02469414
$init
              tau=0.3     tau=0.5
init.est -0.005064993 -0.01347265
init.se   0.015861703  0.02472451

$tmle
            tau=0.3    tau=0.5
tmle.est 0.00265876 0.02741378
tmle.se  0.01586685 0.02472889

Back to top

Use super learner for initial estimation

# NOTE: you need to set the working directory   
source("./simulation-contmle/load.R")      
(run3 <- contmle(dt1, #-- dataset
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("survival"=list(fit="sl", 
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="sl",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1)                                         
                                 ),
                 sl.models=list(
                     mod1=c(Surv(time, delta==1)~A+L1+L2+L3, changepoint=c(0.3, 0.7)),
                     mod2=c(Surv(time, delta==1)~A+L2.squared+L1*L2+L3, changepoint=NULL),
                     mod3=c(Surv(time, delta==1)~A+L1.squared+L1*L2+L3, changepoint=c(0.3, 0.7)),
                     mod4=c(Surv(time, delta==1)~A+L2.squared, changepoint=c(0.3, 0.7)),
                     mod5=c(Surv(time, delta==1)~A+L1.squared, changepoint=c(0.3, 0.7)),
                     mod6=c(Surv(time, delta==1)~A+L1.squared+L2+L3, changepoint=c(0.3, 0.7)),
                     mod7=c(Surv(time, delta==1)~A+L2.squared, changepoint=NULL),
                     mod8=c(Surv(time, delta==1)~A+L1.squared, changepoint=NULL),
                     mod9=c(Surv(time, delta==1)~A+L1+L2+L3, changepoint=NULL),
                     mod10=c(Surv(time, delta==1)~A*L1+L2+L3, changepoint=NULL),
                     mod11=c(Surv(time, delta==1)~A*L1.squared+L2+L3, changepoint=NULL)
                 ),  
                 verbose.sl=TRUE, 
                 ))       
[1] "model picked for survival: A + L1.squared + L1 * L2 + L3"
[1] "changepoint picked: 0.7"
[1] "model picked for cens: A + L1.squared + L1 * L2 + L3"
[1] "changepoint picked: 0.3"
$init
            tau=0.5
init.est 0.05088319
init.se  0.02514863

$tmle
            tau=0.5
tmle.est 0.07081248
tmle.se  0.02516692

Warning message:
In fitter(X, Y, istrat, offset, init, control, weights = weights,  :
  Loglik converged before variable  1 ; beta may be infinite.

Back to top

Results from simulation studies

Monotonicity

In this small simulation study, we investigate one-step TMLE’s ability to fit a monotone survival curve compared to the iterative TMLE. We simple fit the treatment-specific survival curve at four time-points where two of the time-points are very close to each other.

First, let’s look at the results from the one-step TMLE:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")      
source("./simulation-contmle/make.table.fun.R")    
make.table.fun(setting=1, tau=c(0.4, 0.5, 0.99, 1.00), target=1,
               treat.effect="1", M=500, n=300, censoring.informative=TRUE)
[1] "Estimate A=1 (n=300, M=500)"
$F
         true.value          bias         sd   cov   rel.mse
tau=0.4    0.089757  0.0003486295 0.02342802 0.936 0.9886447
tau=0.5    0.128354 -0.0011479946 0.02740761 0.938 0.9931828
tau=0.99   0.284073  0.0006176577 0.03801468 0.946 0.9707157
tau=1      0.286628  0.0007756627 0.03814598 0.952 0.9733194

These look similar to what we achieve with the iterative TMLE:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
source("./simulation-contmle/make.table.fun.R")    
do.call("rbind", lapply(c(0.4, 0.5, 0.99, 1.00), function(tt)  
    make.table.fun(setting=1, tau=tt, target=1,
                   treat.effect="1", M=500, n=300, censoring.informative=TRUE)[[1]]
    ))   
[1] "Estimate A=1 (n=300, M=500)"
[1] "Estimate A=1 (n=300, M=500)"
[1] "Estimate A=1 (n=300, M=500)"
[1] "Estimate A=1 (n=300, M=500)"
         true.value           bias         sd   cov   rel.mse
tau=0.4    0.089899  0.00020970339 0.02342812 0.934 0.9912122
tau=0.5    0.128700 -0.00150778177 0.02740787 0.936 0.9937420
tau=0.99   0.284617  0.00004529501 0.03801478 0.946 0.9700442
tau=1      0.287066  0.00026965476 0.03814609 0.952 0.9744732

But let us also look at the monotonicity properties of the fitted probabilities. First we extract all the fitted values from the simulation study:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
source("./simulation-contmle/make.table.fun.R")    
run.one <- do.call("cbind", make.table.fun(setting=1, tau=c(0.4, 0.5, 0.99, 1.00), target=1, 
                                           output.est=TRUE,
                                           treat.effect="1", M=500, n=300, censoring.informative=TRUE))
run.sep <- do.call("cbind", lapply(c(0.4, 0.5, 0.99, 1.00), function(tt)  
    make.table.fun(setting=1, tau=tt, target=1, output.est=TRUE,
                   treat.effect="1", M=500, n=300, censoring.informative=TRUE)[[1]]
    ))

Then we look at monoticity:

mean(run.one.diff <- apply(run.one, 1, diff)<0)
mean(run.sep.diff <- apply(run.sep, 1, diff)<0) 
[1] 0
[1] 0.03266667

Thus, we see that the iterative TMLE does not always result in a monotone curve. We do note, however, that in the present simulations this mostly kicks in at the time-points very close to each other (tau=0.99,1):

mean(run.sep.diff <- apply(run.sep[,3:4], 1, diff)<0)
[1] 0.094

And almost never at the other time-points (tau=0.4,0.5):

mean(run.sep.diff <- apply(run.sep[,1:2], 1, diff)<0)
[1] 0.004

In these cases, the fitted values look as follows (we only show the worst examples for tau=0.99,1):

          tau=0.99     tau=1
tmle.est 0.3442180 0.3440807
tmle.est 0.3073135 0.3070199
tmle.est 0.2965696 0.2962569
tmle.est 0.2816341 0.2815084
tmle.est 0.2554443 0.2552757
tmle.est 0.2377091 0.2375831
tmle.est 0.2749989 0.2748831
tmle.est 0.2861972 0.2859966
tmle.est 0.2682481 0.2680999
tmle.est 0.3029685 0.3028329
tmle.est 0.2756541 0.2754998
tmle.est 0.2520386 0.2518931

With corresponding one-step fitted values:

          tau=0.99     tau=1
tmle.est 0.3439312 0.3446871
tmle.est 0.3070050 0.3077063
tmle.est 0.2961468 0.2969222
tmle.est 0.2810581 0.2818064
tmle.est 0.2550053 0.2556832
tmle.est 0.2373026 0.2379165
tmle.est 0.2747290 0.2753992
tmle.est 0.2855378 0.2863071
tmle.est 0.2679179 0.2685774
tmle.est 0.3026780 0.3033653
tmle.est 0.2752695 0.2760548
tmle.est 0.2519170 0.2526037

And:

            tau=0.4    tau=0.5
tmle.est 0.07731765 0.07718782
tmle.est 0.13481901 0.13480390

With corresponding one-step fitted values:

           tau=0.4    tau=0.5
tmle.est 0.0769099 0.07770785
tmle.est 0.1343741 0.13526776

Back to top

TMLE for competing risks analysis

Simulated data examples

All data contain three continuous covariates, L_1, L_2, L_3, a binary treatment, A, a time-to-event variable, time, and an event indicator, delta.

Setting 1

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")   
(dt1 <- sim.data2(500, setting=1, competing.risk=TRUE))  
      id      time delta A          L1         L2        L3
  1:   1 0.2874422     1 0  0.30975138 -0.7685858 0.3152207
  2:   2 0.3277389     1 0  0.02027468  0.5996824 0.7876355
  3:   3 0.5929084     1 0 -0.56207753 -0.8157896 0.4990356
  4:   4 0.3566947     2 0 -0.23240904  0.6263003 0.9797428
  5:   5 0.4022813     1 1  0.42003211 -0.5027374 0.8166309
 ---                                                       
496: 496 0.8319554     2 1  0.70791783 -0.7384621 0.1793389
497: 497 0.5464264     2 0  0.33327201  0.5171843 0.1297940
498: 498 0.7545253     2 0 -0.18518105  0.4249485 0.4925814
499: 499 0.5686617     1 1 -0.38356117  0.9970010 0.1349552
500: 500 0.5134096     1 1 -0.11580208  0.3356330 0.3555878

Setting 2

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")   
(dt2 <- sim.data2(500, setting=2, competing.risk=TRUE))  
      id      time delta A          L1        L2        L3
  1:   1 0.5799401     2 1  0.61881053 0.4555461 0.9244269
  2:   2 0.6195841     0 1 -0.05301504 0.9538462 0.5191956
  3:   3 0.3976385     2 0  0.81225760 0.8830862 0.2465510
  4:   4 0.1252781     1 1  0.80605090 0.1536068 0.6741928
  5:   5 0.1745883     1 1  0.95105817 0.6554411 0.9900094
 ---                                                      
496: 496 0.4873752     2 0 -0.01904145 0.8212517 0.8391338
497: 497 0.1826586     0 0 -0.66730849 0.9426368 0.8602731
498: 498 0.6606991     2 1 -0.36369797 0.9727633 0.8323750
499: 499 0.4425950     1 0  0.23650685 0.9604297 0.3021334
500: 500 0.7447092     1 1 -0.66147132 0.2512112 0.5502155

Setting 2 with three causes

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(dt3 <- sim.data2(500, setting=2, no.cr=3, competing.risk=TRUE))  
      id      time delta A          L1         L2        L3
  1:   1 0.1450495     2 0  0.18646167 0.53803176 0.9218310
  2:   2 0.5472824     3 1 -0.91214117 0.18023776 0.2624584
  3:   3 0.4206132     3 1  0.26982345 0.63716911 0.1119786
  4:   4 0.6061732     1 1 -0.52404887 0.68882887 0.4691299
  5:   5 0.5278644     2 1  0.08703335 0.61165321 0.9285522
 ---                                                       
496: 496 0.2583767     0 1  0.32032951 0.99817887 0.8142770
497: 497 0.6388712     3 1  0.97519593 0.02428083 0.1036670
498: 498 0.3337664     1 1  0.81967845 0.10287961 0.7454781
499: 499 0.1383786     2 0  0.23112059 0.68527974 0.5222549
500: 500 0.1981358     0 0 -0.14390677 0.85631816 0.5716522
      id      time delta A          L1          L2        L3
  1:   1 0.2104011     2 1  0.47499590 0.507529442 0.5081989
  2:   2 0.9950924     2 0 -0.18157279 0.465752728 0.6365665
  3:   3 0.0962248     1 0 -0.72525429 0.303056284 0.9455085
  4:   4 0.6079188     1 1 -0.99947581 0.691318560 0.3090190
  5:   5 0.6786964     0 0 -0.57499470 0.990865805 0.7190923
 ---                                                        
496: 496 0.9254278     2 1 -0.32272306 0.754394145 0.2812119
497: 497 1.3892085     1 1 -0.49018167 0.724425462 0.4775683
498: 498 0.7920518     0 0 -0.09834086 0.534232647 0.8407960
499: 499 0.5770960     2 0  0.12161625 0.123686559 0.2523931
500: 500 0.4539557     0 1  0.51500226 0.006624758 0.3918125

Back to top

Examples of applying the code to simulated data

Targeting the cause 1 specific cumulative risk

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")   
(run1 <- contmle(dt2, #-- dataset
                 target=1, #-- go after cause 1 specific risk
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("cause1"=list(fit="cox",
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1),
                                 "cause2"=list(fit="cox",
                                               model=Surv(time, delta==2)~A+L1+L2+L3)                                         
                                 )
                 ))  
$init
$init$F1
             tau=0.5
init.est 0.007793466
init.se  0.040004181


$tmle
$tmle$F1
             tau=0.5
tmle.est 0.003432847
tmle.se  0.040002785

Back to top

Targeting both cause-specific cumulative risks separately

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run2 <- contmle(dt2, #-- dataset
                 target=1:2, #-- go after cause 1 and cause 2 specific risks
                 iterative=TRUE, #-- use iterative tmle to target F1 and F2 separately
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("cause1"=list(fit="cox",
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1),
                                 "cause2"=list(fit="cox",
                                               model=Surv(time, delta==2)~A+L1+L2+L3)                                         
                                 )
                 ))  
$init
$init$F1
             tau=0.5
init.est 0.007793466
init.se  0.040004181

$init$F2
             tau=0.5
init.est -0.09378281
init.se   0.03692451


$tmle
$tmle$F1
             tau=0.5
tmle.est 0.003432847
tmle.se  0.040002785

$tmle$F2
             tau=0.5
tmle.est -0.08613062
tmle.se   0.03692450

Back to top

Targeting the cause-specific cumulative risks simultaneously

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run3 <- contmle(dt2, #-- dataset
                 target=1:2, #-- go after cause 1 and cause 2 specific risks
                 iterative=FALSE, #-- use one-step tmle to target F1 and F2 simultaneously
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("cause1"=list(fit="cox",
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1),
                                 "cause2"=list(fit="cox",
                                               model=Surv(time, delta==2)~A+L1+L2+L3)                                         
                                 )
                 ))   
$init
$init$F1
             tau=0.5
init.est 0.007793466
init.se  0.040004181

$init$F2
             tau=0.5
init.est -0.09378281
init.se   0.03692451


$tmle
$tmle$F1
             tau=0.5
tmle.est 0.003542553
tmle.se  0.040002546

$tmle$F2
             tau=0.5
tmle.est -0.08624101
tmle.se   0.03692414

Back to top

Targeting the cause-specific cumulative risks simultaneously across multiple time-points

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")    
(run4 <- contmle(dt2, #-- dataset
                 target=1:2, #-- go after cause 1 and cause 2 specific risks
                 iterative=FALSE, #-- use one-step tmle to target F1 and F2 simultaneously
                 treat.effect="ate", #-- target the ate directly
                 tau=c(0.3, 0.5), #-- time-point of interest
                 estimation=list("cause1"=list(fit="cox",
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1),
                                 "cause2"=list(fit="cox",
                                               model=Surv(time, delta==2)~A+L1+L2+L3)                                         
                                 )
                 ))   
$init
$init$F1
              tau=0.3     tau=0.5
init.est -0.001742215 0.007793466
init.se   0.028741879 0.040004181

$init$F2
             tau=0.3     tau=0.5
init.est -0.05149133 -0.09378281
init.se   0.02771378  0.03692451


$tmle
$tmle$F1
            tau=0.3     tau=0.5
tmle.est 0.01948492 0.003680884
tmle.se  0.02874492 0.040002053

$tmle$F2
             tau=0.3     tau=0.5
tmle.est -0.04689139 -0.08623811
tmle.se   0.02771312  0.03692375

Back to top

Targeting subsets of cause-specific cumulative risks simultaneously

Here we have a dataset with three causes, but we only target the cause-1 and cause-2 risks:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
(run5 <- contmle(dt3, #-- dataset (with three competing risks) 
                 target=1:2, #-- go after cause 1 and cause 2 specific risks
                 iterative=FALSE, #-- use one-step tmle to target F1 and F2 simultaneously
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest
                 estimation=list("cause1"=list(fit="cox",
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox",
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1),
                                 "cause2"=list(fit="cox",
                                               model=Surv(time, delta==2)~A+L1+L2+L3),                                         
                                 "cause3"=list(fit="cox",
                                               model=Surv(time, delta==3)~A+L1+L2+L3)                                         
                                 )
                 ))    
$init
$init$F1
              tau=0.5
init.est -0.007292943
init.se   0.036790910

$init$F2
             tau=0.5
init.est 0.001042136
init.se  0.035002328


$tmle
$tmle$F1
            tau=0.5
tmle.est 0.01112978
tmle.se  0.03679016

$tmle$F2
             tau=0.5
tmle.est 0.009518483
tmle.se  0.035000835

Similarly, we can target all three cause-specific risks simultaneously:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")        
(run6 <- contmle(dt3, #-- dataset (with three competing risks) 
                 target=1:3, #-- go after all three cause-specific risks
                 iterative=FALSE, #-- use one-step tmle to target F1, F2 and F3 simultaneously
                 treat.effect="ate", #-- target the ate directly
                 tau=0.5, #-- time-point of interest 
                 estimation=list("cause1"=list(fit="cox",
                                               model=Surv(time, delta==1)~A+L1.squared),
                                 "cens"=list(fit="cox", 
                                             model=Surv(time, delta==0)~L1+L2+L3+A*L1),
                                 "cause2"=list(fit="cox",
                                               model=Surv(time, delta==2)~A+L1+L2+L3),                                         
                                 "cause3"=list(fit="cox",
                                               model=Surv(time, delta==3)~A+L1+L2+L3)                                         
                                 )
                 ))    
$init
$init$F1
              tau=0.5
init.est -0.007292943
init.se   0.036790910

$init$F2
             tau=0.5
init.est 0.001042136
init.se  0.035002328

$init$F3
             tau=0.5
init.est -0.04157675
init.se   0.03528795


$tmle
$tmle$F1
            tau=0.5
tmle.est 0.01130622
tmle.se  0.03679005

$tmle$F2
             tau=0.5
tmle.est 0.009468111
tmle.se  0.035000793

$tmle$F3
             tau=0.5
tmle.est -0.04573218
tmle.se   0.03528728

Back to top

Code for simulation studies

# NOTE: you need to set the working directory 
source("./simulation-contmle/load.R") 
test1 <- run.fun(M=1, n=1000, competing.risk=TRUE, 
                 target=1, tau=0.5, 
                 setting=2,
                 censoring.informative=TRUE,
                 iterative=TRUE, 
                 no_cores=1)    
[1] "m=1"
$`m=1`
$`m=1`$init
$`m=1`$init$F1
             tau=0.5
init.est -0.06945745
init.se   0.02777824


$`m=1`$km
$`m=1`$km$F1
           tau=0.5
km.est -0.03353986
km.se   0.02819749


$`m=1`$tmle
$`m=1`$tmle$F1
             tau=0.5
tmle.est -0.04757723
tmle.se   0.02778435

Back to top

Results from simulation studies

Single time-point iterative TMLE for competing risks (three causes)

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
source("./simulation-contmle/make.table.fun.R")     
make.table.fun(setting=2, tau=0.5, target=1:3, cr3=TRUE, 
               fit.outcome="cox", fit.cr="cox", fit.cens="cox", M=500, n=300, 
               iterative=TRUE, competing.risk=TRUE, misspecify.outcome=FALSE,
               censoring.informative=TRUE)    
[1] "Estimate ATE (n=300, M=500)"
$F1
        true.value         bias         sd   cov  rel.mse
tau=0.5  -0.007538 -0.005335258 0.04930792 0.956 1.018455

$F2
        true.value          bias         sd  cov  rel.mse
tau=0.5  -0.050232 -0.0003879127 0.04730437 0.95 1.038196

$F3
        true.value        bias      sd   cov rel.mse
tau=0.5  -0.050664 0.001266594 0.04766 0.944 1.04061
# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
source("./simulation-contmle/make.table.fun.R")     
make.table.fun(setting=2, tau=0.5, target=1:3, cr3=TRUE, 
               fit.outcome="sl", fit.cr="sl", fit.cens="sl", M=500, n=300, 
               iterative=TRUE, competing.risk=TRUE,
               censoring.informative=TRUE)     
[1] "Estimate ATE (n=300, M=500)"
$F1
        true.value         bias         sd  cov  rel.mse
tau=0.5  -0.007538 -0.005419215 0.04986311 0.96 1.028335

$F2
        true.value         bias         sd   cov  rel.mse
tau=0.5  -0.050232 -0.001210021 0.04834965 0.942 1.085933

$F3
        true.value         bias         sd   cov  rel.mse
tau=0.5  -0.050664 0.0008989421 0.04883367 0.952 1.092358

Back to top

Single time-point one-step TMLE for competing risks (three causes)

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
source("./simulation-contmle/summary.fun.R")     
summary.fun(setting=2, tau=0.5, target=1:3, cr3=TRUE,
            fit.outcome="sl", fit.cr="sl", fit.cens="sl", M=500, n=1000, 
            iterative=FALSE, competing.risk=TRUE,
            censoring.informative=TRUE)   
[1] "Estimate ATE (n=1000, M=500)"
$F1
        true.value         bias        sd  cov  rel.mse
tau=0.5  -0.007538 0.0001793097 0.0269632 0.94 0.970743

$F2
        true.value          bias         sd   cov  rel.mse
tau=0.5  -0.050232 -0.0003145141 0.02601505 0.958 1.033968

$F3
        true.value         bias         sd   cov   rel.mse
tau=0.5  -0.050664 0.0004003152 0.02617214 0.944 0.9890767

Back to top

Two time-points one-step TMLE for competing risks (three causes)

Unweighted inner product:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")     
source("./simulation-contmle/summary.fun.R")     
summary.fun(setting=2, tau=c(0.35, 0.5), target=1:3, cr3=TRUE,
            fit.outcome="cox", fit.cr="cox", fit.cens="cox", M=500, n=300, 
            iterative=FALSE, competing.risk=TRUE, 
            censoring.informative=TRUE)    
[1] "Estimate ATE (n=300, M=500)"
$F1
         true.value         bias         sd   cov   rel.mse
tau=0.35  -0.010336 -0.004990964 0.04087722 0.954 0.8617386
tau=0.5   -0.006968 -0.006094558 0.04930366 0.954 1.0094925

$F2
         true.value          bias         sd   cov   rel.mse
tau=0.35   -0.03870 -0.0002046165 0.03882936 0.956 0.8947348
tau=0.5    -0.05009 -0.0003326479 0.04728705 0.950 1.0062482

$F3
         true.value        bias         sd   cov   rel.mse
tau=0.35  -0.039266 0.001567532 0.03911725 0.968 0.9006001
tau=0.5   -0.050453 0.001381332 0.04766251 0.946 1.0056505

Here we have used the inner product weighted by the standard error of the efficient influence function:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")      
source("./simulation-contmle/summary.fun.R")      
summary.fun(setting=2, tau=c(0.35, 0.5), target=1:3, cr3=TRUE,
            fit.outcome="cox", fit.cr="cox", fit.cens="cox", M=500, n=300, 
            iterative=FALSE, competing.risk=TRUE, weighted.norm="sigma", 
            censoring.informative=TRUE) 
[1] "Estimate ATE (n=300, M=500)"
$F1
         true.value         bias         sd   cov   rel.mse
tau=0.35  -0.010336 -0.004747987 0.04087767 0.952 0.8900914
tau=0.5   -0.006968 -0.005926739 0.04930502 0.964 1.0011447

$F2
         true.value          bias         sd   cov   rel.mse
tau=0.35   -0.03870 -0.0003789272 0.03882859 0.954 0.9263194
tau=0.5    -0.05009 -0.0004961173 0.04728644 0.948 1.0014458

$F3
         true.value        bias         sd   cov   rel.mse
tau=0.35  -0.039266 0.001551587 0.03911732 0.964 0.9292563
tau=0.5   -0.050453 0.001387621 0.04766632 0.946 0.9986212

Inner product weighted by covariance matrix:

# NOTE: you need to set the working directory  
source("./simulation-contmle/load.R")      
source("./simulation-contmle/summary.fun.R")     
summary.fun(setting=2, tau=c(0.35, 0.5), target=1:3, cr3=TRUE,
            fit.outcome="cox", fit.cr="cox", fit.cens="cox", M=500, n=300, 
            iterative=FALSE, competing.risk=TRUE, weighted.norm="Sigma", 
            censoring.informative=TRUE)     
[1] "Estimate ATE (n=300, M=500)"
$F1
         true.value         bias         sd       cov   rel.mse
tau=0.35  -0.010336 -0.004954027 0.04088965 0.9519038 0.9733054
tau=0.5   -0.006968 -0.006118715 0.04930854 0.9599198 0.9947518

$F2
         true.value           bias         sd       cov   rel.mse
tau=0.35   -0.03870  0.00007250139 0.03883329 0.9458918 0.9534236
tau=0.5    -0.05009 -0.00042490968 0.04729003 0.9539078 0.9871664

$F3
         true.value        bias         sd       cov   rel.mse
tau=0.35  -0.039266 0.001809895 0.03912174 0.9519038 0.9826952
tau=0.5   -0.050453 0.001003023 0.04765887 0.9539078 0.9824652

Back to top

Dependencies

R-version

The code has been tested with the following R version

               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again

and the following package versions:

PackageVersion
data.table1.13.0
zoo1.8.8
stringr1.4.0
ltmle1.2.0
parallel4.0.2
foreach1.5.0
doParallel1.0.15

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages