16  TMLE

16.1 Obtain OR with superlearner

summary(W.out$ps)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#> 0.01826 0.22575 0.39324 0.42094 0.59037 0.98809
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.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.433163
#> 
#> $log.psi
#> [1] 0.3598838
#> 
#> $CI
#> [1] 1.228595 1.671792
#> 
#> $pvalue
#> [1] 4.65237e-06
#> 
#> $var.log.psi
#> [1] 0.0061747
#> 
#> $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.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.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.459564
#> 
#> $log.psi
#> [1] 0.3781375
#> 
#> $CI
#> [1] 1.256360 1.695633
#> 
#> $pvalue
#> [1] 7.669587e-07
#> 
#> $var.log.psi
#> [1] 0.005850784
#> 
#> $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).