Skip to content

Commit c719b9d

Browse files
committed
fix tipr function
1 parent be4b9a3 commit c719b9d

File tree

3 files changed

+60
-42
lines changed

3 files changed

+60
-42
lines changed

exercises/08-tipr.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Using the National Health and Nutrition Examination Survey Data (`nhefs_complete
1212

1313
## Your turn
1414

15-
Use the `lm_tip()` function to conduct a sensitivity analysis for the estimate from your previous exercises.
15+
Use the `tip_coef()` function to conduct a sensitivity analysis for the estimate from your previous exercises.
1616

1717
```{r}
1818

slides/raw/08-tipr.Rmd

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ class: inverse, center, middle
162162

163163
## Main function
164164

165-
# `lm_tip()`
165+
# `tip_coef()`
166166

167-
* `d`: a data frame that includes the observed confidence bounds
167+
* `effect`: observed exposure - outcome effect
168168
---
169169

170170

@@ -179,7 +179,7 @@ class: inverse, center, middle
179179

180180
## Main function
181181

182-
# `lm_tip()`
182+
# `tip_coef()`
183183
* `smd`: scaled mean difference between the unmeasured confounder in the exposed and unexposed population
184184

185185

@@ -198,7 +198,7 @@ class: inverse, center, middle
198198

199199
## Main function
200200

201-
# `lm_tip()`
201+
# `tip_coef()`
202202
* `outcome_association`: association between the unmeasured confounder and outcome
203203

204204
---
@@ -214,16 +214,16 @@ class: inverse, center, middle
214214

215215
## Main function
216216

217-
# `lm_tip()`
217+
# `tip_coef()`
218218

219-
* `d`
219+
* `effect`
220220
* `smd`
221221
* `outcome_association`
222222
---
223223

224224
## Main function
225225

226-
# `lm_tip()`
226+
# `tip_coef()`
227227

228228
### **specify** one, it will **estimate** the other
229229

@@ -241,24 +241,23 @@ class: inverse, center, middle
241241

242242
```{r, eval = TRUE}
243243
library(tipr)
244-
lm_tip(data.frame(conf.low = 2.4,
245-
conf.high = 4.4),
246-
smd = 0.3)
244+
tip_coef(effect = 2.4,
245+
smd = 0.3)
247246
```
248247

249248
--
250249

251250
The observed effect (2.4, 4.4) WOULD be tipped by 1 unmeasured confounder
252251
with the following specifications:
253252

254-
*estimated standardized mean difference between the unmeasured confounder
255-
in the exposed population and unexposed population: 0.3*
256-
257-
*estimated association between the unmeasured confounder and the outcome: 8*
253+
*estimated standardized mean difference between the unmeasured confounder
254+
in the exposed population and unexposed population: 0.3*
255+
256+
*estimated association between the unmeasured confounder and the outcome: 8*
258257
---
259258

260259
## Your turn
261260

262261
`r countdown::countdown(minutes = 10)`
263262

264-
1. Use the `lm_tip()` function to conduct a sensitivity analysis for the estimate from your previous exercises.
263+
1. Use the `tip_coef()` function to conduct a sensitivity analysis for the estimate from your previous exercises.

slides/raw/08-tipr.html

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@
44
<title>Tipping Point Sensitivity Analyses</title>
55
<meta charset="utf-8" />
66
<meta name="author" content="Lucy D’Agostino McGowan" />
7-
<script src="libs/header-attrs/header-attrs.js"></script>
8-
<link href="libs/remark-css/default.css" rel="stylesheet" />
9-
<link href="libs/countdown/countdown.css" rel="stylesheet" />
10-
<script src="libs/countdown/countdown.js"></script>
7+
<script src="libs/header-attrs-2.14/header-attrs.js"></script>
8+
<link href="libs/remark-css-0.0.1/default.css" rel="stylesheet" />
9+
<link href="libs/countdown-0.3.5/countdown.css" rel="stylesheet" />
10+
<script src="libs/countdown-0.3.5/countdown.js"></script>
1111
<link rel="stylesheet" href="theme.css" type="text/css" />
1212
</head>
1313
<body>
1414
<textarea id="source">
1515
class: center, middle, inverse, title-slide
1616

17+
.title[
1718
# Tipping Point Sensitivity Analyses
19+
]
20+
.author[
1821
### Lucy D’Agostino McGowan
22+
]
23+
.institute[
1924
### Wake Forest University
20-
### 2021-09-01 (updated: 2021-10-21)
25+
]
26+
.date[
27+
### 2021-09-01 (updated: 2022-06-07)
28+
]
2129

2230
---
2331

@@ -164,9 +172,9 @@
164172

165173
## Main function
166174

167-
# `lm_tip()`
175+
# `tip_coef()`
168176

169-
* `d`: a data frame that includes the observed confidence bounds
177+
* `effect`: observed exposure - outcome effect
170178
---
171179

172180

@@ -181,7 +189,7 @@
181189

182190
## Main function
183191

184-
# `lm_tip()`
192+
# `tip_coef()`
185193
* `smd`: scaled mean difference between the unmeasured confounder in the exposed and unexposed population
186194

187195

@@ -200,7 +208,7 @@
200208

201209
## Main function
202210

203-
# `lm_tip()`
211+
# `tip_coef()`
204212
* `outcome_association`: association between the unmeasured confounder and outcome
205213

206214
---
@@ -216,16 +224,16 @@
216224

217225
## Main function
218226

219-
# `lm_tip()`
227+
# `tip_coef()`
220228

221-
* `d`
229+
* `effect`
222230
* `smd`
223231
* `outcome_association`
224232
---
225233

226234
## Main function
227235

228-
# `lm_tip()`
236+
# `tip_coef()`
229237

230238
### **specify** one, it will **estimate** the other
231239

@@ -244,37 +252,35 @@
244252

245253
```r
246254
library(tipr)
247-
lm_tip(data.frame(conf.low = 2.4,
248-
conf.high = 4.4),
249-
smd = 0.3)
255+
tip_coef(effect = 2.4,
256+
smd = 0.3)
250257
```
251258

252259
```
253-
## # A tibble: 1 × 5
254-
## observed_lb observed_ub smd outcome_association
255-
## &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
256-
## 1 2.4 4.4 0.3 8
257-
## # … with 1 more variable: n_unmeasured_confounders &lt;dbl&gt;
260+
## # A tibble: 1 × 4
261+
## observed_effect smd outcome_association n_unmeasured_confounders
262+
## &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
263+
## 1 2.4 0.3 8 1
258264
```
259265

260266
--
261267

262268
The observed effect (2.4, 4.4) WOULD be tipped by 1 unmeasured confounder
263269
with the following specifications:
264270

265-
*estimated standardized mean difference between the unmeasured confounder
266-
in the exposed population and unexposed population: 0.3*
267-
268-
*estimated association between the unmeasured confounder and the outcome: 8*
271+
*estimated standardized mean difference between the unmeasured confounder
272+
in the exposed population and unexposed population: 0.3*
273+
274+
*estimated association between the unmeasured confounder and the outcome: 8*
269275
---
270276

271277
## Your turn
272278

273-
<div class="countdown" id="timer_61718391" style="right:0;bottom:0;" data-warnwhen="0">
279+
<div class="countdown" id="timer_629fa62c" style="right:0;bottom:0;" data-warnwhen="0">
274280
<code class="countdown-time"><span class="countdown-digits minutes">10</span><span class="countdown-digits colon">:</span><span class="countdown-digits seconds">00</span></code>
275281
</div>
276282

277-
1. Use the `lm_tip()` function to conduct a sensitivity analysis for the estimate from your previous exercises.
283+
1. Use the `tip_coef()` function to conduct a sensitivity analysis for the estimate from your previous exercises.
278284
</textarea>
279285
<style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
280286
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
@@ -326,6 +332,19 @@
326332
deleted = true;
327333
});
328334
})();
335+
// add `data-at-shortcutkeys` attribute to <body> to resolve conflicts with JAWS
336+
// screen reader (see PR #262)
337+
(function(d) {
338+
let res = {};
339+
d.querySelectorAll('.remark-help-content table tr').forEach(tr => {
340+
const t = tr.querySelector('td:nth-child(2)').innerText;
341+
tr.querySelectorAll('td:first-child .key').forEach(key => {
342+
const k = key.innerText;
343+
if (/^[a-z]$/.test(k)) res[k] = t; // must be a single letter (key)
344+
});
345+
});
346+
d.body.setAttribute('data-at-shortcutkeys', JSON.stringify(res));
347+
})(document);
329348
(function() {
330349
"use strict"
331350
// Replace <script> tags in slides area to make them executable

0 commit comments

Comments
 (0)