16  TMLE

16.1 Obtain OR with superlearner

summary(W.out$ps)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#> 0.01919 0.22474 0.38968 0.42094 0.59528 0.99131
SL.library = c("SL.glm", "SL.glmnet","SL.earth")
proxy.list <- names(out2[-1])
# out3$autoselected_covariate_df[,-1] for hybrid 
# out2 is from step2$recurrence_data
ObsData.noYA <- hdps.data[,c(investigator.specified.covariates, 
                             proxy.list)]

We use the same propensity score model that was fitted based on super learning algorithm.

tmle.fit <- tmle::tmle(Y = hdps.data$outcome,
                       A = hdps.data$exposure, 
                       W = ObsData.noYA, 
                       family = "binomial",
                       V.Q = 3,
                       V.g = 3,
                       Q.SL.library = SL.library,
                       g1W = W.out$ps)

If you want to know more about TMLE, look at other tutorials.

estOR.tmle <- tmle.fit$estimates$OR
estOR.tmle
#> $psi
#> [1] 1.465619
#> 
#> $log.psi
#> [1] 0.382278
#> 
#> $CI
#> [1] 1.268728 1.693067
#> 
#> $pvalue
#> [1] 2.062344e-07
#> 
#> $var.log.psi
#> [1] 0.005417723
#> 
#> $bs.var.log.psi
#> [1] NA
#> 
#> $bs.CI.twosided
#> [1] NA NA
#> 
#> $bs.CI.onesided.lower
#> [1] -Inf   NA
#> 
#> $bs.CI.onesided.upper
#> [1]  NA Inf

Summary of results (OR).

16.2 Obtain OR without superlearner

summary(W.out0$ps)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#> 0.01333 0.21054 0.38992 0.42094 0.61259 0.99414
SL.library = c("SL.glm")
proxy.list <- names(out2[-1])
# out3$autoselected_covariate_df[,-1] for hybrid 
# out2 is from step2$recurrence_data
ObsData.noYA <- hdps.data[,c(investigator.specified.covariates, 
                             proxy.list)]

We use the same propensity score model that was fitted based on hdPS variables via logistic regression (no other learners).

tmle.fit0 <- tmle::tmle(Y = hdps.data$outcome,
                       A = hdps.data$exposure, 
                       W = ObsData.noYA, 
                       family = "binomial",
                       V.Q = 3,
                       V.g = 3,
                       Q.SL.library = SL.library,
                       g1W = W.out$ps)
estOR.tmle0 <- tmle.fit0$estimates$OR
estOR.tmle0
#> $psi
#> [1] 1.459729
#> 
#> $log.psi
#> [1] 0.3782507
#> 
#> $CI
#> [1] 1.261396 1.689247
#> 
#> $pvalue
#> [1] 3.840893e-07
#> 
#> $var.log.psi
#> [1] 0.005551369
#> 
#> $bs.var.log.psi
#> [1] NA
#> 
#> $bs.CI.twosided
#> [1] NA NA
#> 
#> $bs.CI.onesided.lower
#> [1] -Inf   NA
#> 
#> $bs.CI.onesided.upper
#> [1]  NA Inf

Summary of results (OR).