17  TMLE

17.1 Obtain OR with superlearner

summary(W.out$ps)
#>     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
#> 0.006352 0.250715 0.430072 0.448121 0.628521 0.982149
SL.library = c("SL.glm", "SL.glmnet","SL.earth")
proxy.list <- names(out3$autoselected_covariate_df[,-1])
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 = 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.565526
#> 
#> $CI
#> [1] 1.407437 1.741373
#> 
#> $pvalue
#> [1] 1.548568e-16
#> 
#> $log.psi
#> [1] 0.4482221
#> 
#> $var.log.psi
#> [1] 0.002949814

Summary of results (OR).

17.2 Obtain OR without superlearner

summary(W.out0$ps)
#>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
#> 0.0000003 0.2445201 0.4308397 0.4481213 0.6321148 0.9975438
SL.library = c("SL.glm")
proxy.list <- names(out3$autoselected_covariate_df[,-1])
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 = 3,
                       Q.SL.library = SL.library,
                       g1W = W.out$ps)
estOR.tmle0 <- tmle.fit0$estimates$OR
estOR.tmle0
#> $psi
#> [1] 1.549417
#> 
#> $CI
#> [1] 1.390011 1.727104
#> 
#> $pvalue
#> [1] 2.675267e-15
#> 
#> $log.psi
#> [1] 0.4378789
#> 
#> $var.log.psi
#> [1] 0.003068198

Summary of results (OR).