Skip to content

Commit d5191e6

Browse files
committed
Aug24 update
1 parent 85e2588 commit d5191e6

File tree

114 files changed

+18091
-1706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+18091
-1706
lines changed

1RHC.Rmd

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ There is a widespread belief among cardiologists that the right heart catheteriz
1414

1515
## Data download
1616

17+
```{block, type='rmdcomment'}
1718
Data is freely available from [Vanderbilt Biostatistics](https://hbiostat.org/data/).
19+
```
20+
1821

1922
```{r, cache=TRUE}
2023
# load the dataset
@@ -24,6 +27,8 @@ saveRDS(ObsData, file = "data/rhc.RDS")
2427

2528
## Analytic data
2629

30+
Below we show the process of creating the analytic data (optional).
31+
2732
```{r, warning=FALSE}
2833
# add column for outcome Y: length of stay
2934
# Y = date of discharge - study admission date
@@ -84,8 +89,6 @@ saveRDS(ObsData, file = "data/rhcAnalytic.RDS")
8489
|---|---|
8590
|$A$: Exposure status | RHC |
8691
|$Y$: Observed outcome | length of stay |
87-
|$Y(A=1)$ = potential outcome when exposed | length of stay when RHC used |
88-
|$Y(A=0)$ = potential outcome when not exposed | length of stay when RHC not used |
8992
|$L$: Covariates | See below |
9093

9194
## Variables
@@ -98,7 +101,10 @@ baselinevars
98101

99102
## Table 1 stratified by RHC exposure
100103

104+
```{block, type='rmdcomment'}
101105
Only for some demographic and co-morbidity variables; match with Table 1 in @connors1996effectiveness.
106+
```
107+
102108

103109
```{r tab0, cache=TRUE, echo = TRUE}
104110
require(tableone)
@@ -109,7 +115,9 @@ tab0 <- CreateTableOne(vars = c("age", "sex", "race", "Disease.category", "Cance
109115
print(tab0, showAllLevels = FALSE, )
110116
```
111117

118+
```{block, type='rmdcomment'}
112119
Only outcome variable (Length of stay); slightly different than Table 2 in @connors1996effectiveness (means 20.5 vs. 25.7; and medians 13 vs. 17).
120+
```
113121

114122
```{r tab1, cache=TRUE, echo = TRUE}
115123
tab1 <- CreateTableOne(vars = c("Y"),
@@ -151,91 +159,117 @@ adj.fit <- publish(fit1, digits=1)$regressionTable[2,]
151159
saveRDS(fit1, file = "data/adjreg.RDS")
152160
```
153161

154-
### Regression diagnostics
155-
156162
```{r reg2a, cache=TRUE, echo = TRUE}
157163
out.formula
158-
adj.fit
164+
adj.fit
165+
```
166+
167+
### Regression diagnostics
168+
169+
```{r reg2a578, cache=TRUE, echo = TRUE}
159170
plot(fit1)
160171
```
161172

173+
```{block, type='rmdcomment'}
162174
Diagnostics do not necessarily look so good.
175+
```
176+
163177

164178
## Comparison with literature
165179

166-
@connors1996effectiveness conducted a propensity score matching analysis. Table 5 in @connors1996effectiveness showed that, after propensity score pair (1-to-1) matching, means of length of stay ($Y$), when stratified by RHC ($A$) was significantly different.
180+
```{block, type='rmdcomment'}
181+
@connors1996effectiveness conducted a propensity score matching analysis.
182+
```
183+
184+
Table 5 in @connors1996effectiveness showed that, after propensity score pair (1-to-1) matching, means of length of stay ($Y$), when stratified by RHC ($A$) were not significantly different ($p = 0.14$).
167185

168186
### PSM in RHC data
169187

170188
We also conduct propensity score pair matching analysis, as follows.
171189

190+
```{block, type='rmdcomment'}
172191
**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/).
192+
```
173193

174194
```{r ps16854, cache=TRUE, echo = TRUE}
175-
set.seed(123)
195+
set.seed(111)
176196
require(MatchIt)
177197
ps.formula <- as.formula(paste("A~",
178198
paste(baselinevars, collapse = "+")))
179199
PS.fit <- glm(ps.formula,family="binomial",
180200
data=ObsData)
181201
ObsData$PS <- predict(PS.fit,
182-
newdata = ObsData, type="response")
202+
newdata = ObsData, type="response")
183203
```
184204

185205

186206

187207
```{r ps2, cache=TRUE, echo = TRUE}
188-
logitPS <- -log(1/ObsData$PS - 1)
208+
logitPS <- -log(1/ObsData$PS - 1)
189209
match.obj <- matchit(ps.formula, data =ObsData,
190210
distance = ObsData$PS,
191211
method = "nearest", replace=FALSE,
192-
ratio = 1, caliper = .1*sd(logitPS))
212+
ratio = 1,
213+
caliper = .2*sd(logitPS))
193214
```
194215

195216
#### PSM diagnostics
196217

197218
```{r ps2x, cache=TRUE, echo = TRUE}
198219
require(cobalt)
199-
bal.plot(match.obj,
220+
bal.plot(match.obj,
200221
var.name = "distance",
201-
which = "both",
202-
type = "histogram",
222+
which = "both",
223+
type = "histogram",
203224
mirror = TRUE)
225+
bal.tab(match.obj, un = TRUE,
226+
thresholds = c(m = .1))
204227
```
205228

206229

207230
```{r ps2b, cache=TRUE, echo = TRUE, fig.height=10, fig.width=5}
208-
love.plot(match.obj, binary = "std",
209-
thresholds = c(m = .1))
231+
love.plot(match.obj, binary = "std",
232+
thresholds = c(m = .1))
210233
```
211234

212235
The love plot suggests satisfactory propensity score matching (all SMD < 0.1).
213236

214237
#### PSM results
215238

216239
```{r ps3, cache=TRUE, echo = TRUE}
217-
matched.data <- match.data(match.obj)
240+
matched.data <- match.data(match.obj)
218241
tab1y <- CreateTableOne(vars = c("Y"),
219242
data = matched.data, strata = "A",
220243
test = TRUE)
221244
print(tab1y, showAllLevels = FALSE,
222245
test = TRUE)
223246
```
224247

225-
- Hence, we also find the same conclusion based on propensity score pair matched data.
248+
```{block, type='rmdcomment'}
249+
Hence, our conclusion based on propensity score pair matched data ($p \lt 0.001$) is different than Table 5 in @connors1996effectiveness ($p = 0.14$). Variability in results for 1-to-1 matching is possible, and modelling choices may be different (we used caliper option here).
250+
```
251+
226252
- We can also estimate the effect of `RHC` on `length of stay` using propensity score-matched sample:
227253

228254
```{r ps12ryy, cache=TRUE, echo = TRUE}
229255
fit.matched <- glm(Y~A,
230-
family=gaussian,
231-
data = matched.data)
256+
family=gaussian,
257+
data = matched.data)
232258
publish(fit.matched)
233259
```
234260

235261
```{r, cache=TRUE, echo = TRUE}
236-
saveRDS(fit.matched, file = "data/match.RDS")
262+
saveRDS(fit.matched, file = "data/match.RDS")
237263
```
238264

239265
### TMLE in RHC data
240266

241-
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.
267+
There are other papers that have used RHC data [@keele2021comparing;@keele2018pre].
268+
269+
```{block, type='rmdcomment'}
270+
@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)$.
271+
```
272+
273+
In today's workshop, we will learn about TMLE-SL methods.
274+
275+

0 commit comments

Comments
 (0)