Skip to content

Commit c741820

Browse files
committed
results aggregated
1 parent 5ad5960 commit c741820

40 files changed

+2828
-1423
lines changed

1RHC.Rmd

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ We also conduct propensity score pair matching analysis, as follows.
168168

169169
**Note**: In this workshop, we will not cover Propensity Score Matching (PSM) in this workshop. If you want to learn more about this, feel free to check out this other workshop: [Understanding Propensity Score Matching](https://ehsanx.github.io/psw/).
170170

171-
```{r ps1, cache=TRUE, echo = TRUE}
171+
```{r ps16854, cache=TRUE, echo = TRUE}
172172
set.seed(123)
173173
require(MatchIt)
174174
ps.formula <- as.formula(paste("A~",
@@ -216,11 +216,23 @@ tab1y <- CreateTableOne(vars = c("Y"),
216216
data = matched.data, strata = "A",
217217
test = TRUE)
218218
print(tab1y, showAllLevels = FALSE,
219-
test = TRUE)
219+
test = TRUE)
220220
```
221221

222-
We also find the same conclusion based on propensity score pair matched data.
222+
- Hence, we also find the same conclusion based on propensity score pair matched data.
223+
- We can also estimate the effect of `RHC` on `length of stay` using propensity score-matched sample:
224+
225+
```{r ps12ryy, cache=TRUE, echo = TRUE}
226+
fit.matched <- glm(Y~A,
227+
family=gaussian,
228+
data = matched.data)
229+
publish(fit.matched)
230+
```
231+
232+
```{r, cache=TRUE, echo = TRUE}
233+
saveRDS(fit.matched, file = "data/match.RDS")
234+
```
223235

224236
### TMLE in RHC data
225237

226-
There are other papers that have used RHC data [@keele2021comparing;@keele2018pre]. Particularly, @keele2021comparing used TMLE method in estimating the impact of RHC on length of stay, and found point estimate $2.01 (95\% CI: 0.6-3.41)$. In today's workshop, we will learn about TMLE method.
238+
There are other papers that have used RHC data [@keele2021comparing;@keele2018pre]. Particularly, @keele2021comparing used TMLE (with super learner) method in estimating the impact of RHC on length of stay, and found point estimate $2.01 (95\% CI: 0.6-3.41)$. In today's workshop, we will learn about TMLE method.

2gcomp.Rmd

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# G-computation
22

3-
```{r setup01, include=FALSE}
3+
```{r setup01g, include=FALSE}
44
require(boot)
55
require(knitr)
66
require(glmnet)
@@ -277,7 +277,8 @@ ObsData$Pred.TE <- ObsData$Pred.Y1 - ObsData$Pred.Y0
277277
Mean value of predicted treatment effect
278278

279279
```{r reg2acnx1, cache=cachex, echo = TRUE}
280-
mean(ObsData$Pred.TE)
280+
TE <- mean(ObsData$Pred.TE)
281+
TE
281282
```
282283

283284
SD of treatment effect
@@ -341,8 +342,14 @@ Below are two versions of confidence interval.
341342
- Another is based on percentiles
342343

343344
```{r bootx3, cache=cachex, echo = TRUE}
344-
boot.ci(gcomp.res, type="norm")
345-
boot.ci(gcomp.res, type="perc")
345+
CI1 <- boot.ci(gcomp.res, type="norm")
346+
CI1
347+
CI2 <- boot.ci(gcomp.res, type="perc")
348+
CI2
346349
```
347350

351+
```{r, cache=TRUE, echo = TRUE}
352+
saveRDS(TE, file = "data/gcomp.RDS")
353+
saveRDS(CI2, file = "data/gcompci.RDS")
354+
```
348355

2gcomp2.Rmd

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# G-computation using ML
22

3-
```{r setup01, include=FALSE}
3+
```{r setup01gm, include=FALSE}
44
require(knitr)
55
require(glmnet)
66
require(kableExtra)
@@ -199,6 +199,8 @@ ObsData$Pred.TE <- ObsData$Pred.Y1 - ObsData$Pred.Y0
199199
Mean value of predicted treatment effect
200200

201201
```{r reg2acnx1b, cache=cachex, echo = TRUE}
202+
TE1 <- mean(ObsData$Pred.TE)
203+
TE1
202204
summary(ObsData$Pred.TE)
203205
```
204206

@@ -257,6 +259,8 @@ ObsData$Pred.TE <- ObsData$Pred.Y1 - ObsData$Pred.Y0
257259
Mean value of predicted treatment effect
258260

259261
```{r reg2acnx1br, cache=cachex, echo = TRUE}
262+
TE2 <- mean(ObsData$Pred.TE)
263+
TE2
260264
summary(ObsData$Pred.TE)
261265
```
262266

@@ -461,6 +465,8 @@ ObsData$Pred.TE <- ObsData$Pred.Y1 - ObsData$Pred.Y0
461465
Mean value of predicted treatment effect
462466

463467
```{r reg2acnx1bs, cache=cachex, echo = TRUE}
468+
TE3 <- mean(ObsData$Pred.TE)
469+
TE3
464470
summary(ObsData$Pred.TE)
465471
```
466472

@@ -479,4 +485,10 @@ fit.sl2 <- recombineSL(fit.sl, Y = Y, method = "method.CC_LS")
479485
fit.sl2$coef
480486
fit.sl4 <- recombineSL(fit.sl, Y = Y, method = "method.CC_nloglik")
481487
fit.sl4$coef
482-
```
488+
```
489+
490+
```{r, cache=TRUE, echo = TRUE}
491+
saveRDS(TE1, file = "data/gcompxg.RDS")
492+
saveRDS(TE2, file = "data/gcompls.RDS")
493+
saveRDS(TE3, file = "data/gcompsl.RDS")
494+
```

3ipw.Rmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
In this chapter, we are not only interested in outcome modelling, but also **exposure modelling**.
44

5-
```{r setup01, include=FALSE}
5+
```{r setup01i, include=FALSE}
66
require(knitr)
77
require(glmnet)
88
require(kableExtra)
@@ -147,3 +147,6 @@ publish(out.fit)
147147
```
148148

149149

150+
```{r, cache=TRUE, echo = TRUE}
151+
saveRDS(out.fit, file = "data/ipw.RDS")
152+
```

3ipw2.Rmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Similar to G-computation, we will try to use machine learning methods, particularly Superlearner in estimating IPW estimates
44

5-
```{r ipw2setup01, include=FALSE}
5+
```{r ipw2setup01ic, include=FALSE}
66
require(knitr)
77
require(glmnet)
88
require(kableExtra)
@@ -162,3 +162,6 @@ out.fit <- glm(out.formula,
162162
publish(out.fit)
163163
```
164164

165+
```{r, cache=TRUE, echo = TRUE}
166+
saveRDS(out.fit, file = "data/ipwsl.RDS")
167+
```

4tmle.Rmd

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TMLE
22

3-
```{r tmlesetup01, include=FALSE}
3+
```{r tmlesetup01t, include=FALSE}
44
require(knitr)
55
require(glmnet)
66
require(kableExtra)
@@ -449,13 +449,15 @@ ci.estimate <- function(data = ObsData, H.AL.components = 1){
449449
### $\hat\epsilon$ = $\hat\epsilon_0$ and $\hat\epsilon_1$
450450

451451
```{r tmleinf2b, cache=TRUE}
452-
ci.estimate(data = ObsData, H.AL.components = 2)
452+
CI2 <- ci.estimate(data = ObsData, H.AL.components = 2)
453+
CI2
453454
```
454455

455456
### Only 1 $\hat\epsilon$
456457

457458
```{r tmleinf2c, cache=TRUE}
458-
ci.estimate(data = ObsData, H.AL.components = 1)
459+
CI1 <- ci.estimate(data = ObsData, H.AL.components = 1)
460+
CI1
459461
```
460462

461463
```{r tmleinf, cache=TRUE, include = FALSE}
@@ -477,3 +479,8 @@ ci.estimate(data = ObsData, H.AL.components = 1)
477479
# ATE_TMLE1_CI <- c(ATE_TMLE1 - 1.96*sqrt(varHat.IC), ATE_TMLE1 + 1.96*sqrt(varHat.IC))
478480
# cat("ATE: ", ATE_TMLE1, " (", ATE_TMLE1_CI[1], ", ", ATE_TMLE1_CI[2], ")", sep = "")
479481
```
482+
483+
```{r, cache=TRUE, echo = TRUE}
484+
saveRDS(ATE.TMLE1, file = "data/tmlepointh.RDS")
485+
saveRDS(CI2, file = "data/tmlecih.RDS")
486+
```

0 commit comments

Comments
 (0)