@@ -25,7 +25,7 @@ Or install the development version from GitHub:
25
25
26
26
``` r
27
27
# install.packages(devtools)
28
- devtools :: install_github(" lucymcgowan /tipr" )
28
+ devtools :: install_github(" r-causal /tipr" )
29
29
```
30
30
31
31
``` r
@@ -61,7 +61,7 @@ relationship using the measured confounder as follows:
61
61
mod <- glm(outcome ~ exposure + measured_confounder , data = exdata_rr ,
62
62
family = poisson )
63
63
64
- mod % > %
64
+ mod | >
65
65
broom :: tidy(exponentiate = TRUE , conf.int = TRUE )
66
66
```
67
67
@@ -96,12 +96,11 @@ between the unmeasured confounder and outcome needed to tip the analysis
96
96
tip(effect_observed = 1.5 , exposure_confounder_effect = 0.5 )
97
97
```
98
98
99
- ## ℹ The observed effect (1.5) WOULD be tipped by 1 unmeasured confounder with the
100
- ## following specifications:
101
- ## • estimated difference in scaled means between the unmeasured confounder in the
102
- ## exposed population and unexposed population: 0.5
103
- ## • estimated relationship between the unmeasured confounder and the outcome:
104
- ## 2.25
99
+ ## The observed effect (1.5) WOULD be tipped by 1 unmeasured confounder
100
+ ## with the following specifications:
101
+ ## * estimated difference in scaled means between the unmeasured confounder
102
+ ## in the exposed population and unexposed population: 0.5
103
+ ## * estimated relationship between the unmeasured confounder and the outcome: 2.25
105
104
106
105
## # A tibble: 1 × 5
107
106
## effect_adjusted effect_observed exposure_confounder_effect confounde…¹ n_unm…²
@@ -118,12 +117,11 @@ between exposure groups of `0.5` would need a relationship of at least
118
117
tip(effect_observed = 1.09 , exposure_confounder_effect = 0.5 )
119
118
```
120
119
121
- ## ℹ The observed effect (1.09) WOULD be tipped by 1 unmeasured confounder with
122
- ## the following specifications:
123
- ## • estimated difference in scaled means between the unmeasured confounder in the
124
- ## exposed population and unexposed population: 0.5
125
- ## • estimated relationship between the unmeasured confounder and the outcome:
126
- ## 1.19
120
+ ## The observed effect (1.09) WOULD be tipped by 1 unmeasured confounder
121
+ ## with the following specifications:
122
+ ## * estimated difference in scaled means between the unmeasured confounder
123
+ ## in the exposed population and unexposed population: 0.5
124
+ ## * estimated relationship between the unmeasured confounder and the outcome: 1.19
127
125
128
126
## # A tibble: 1 × 5
129
127
## effect_adjusted effect_observed exposure_confounder_effect confounde…¹ n_unm…²
@@ -142,12 +140,12 @@ confounder looked like. First we will calculate the difference in scaled
142
140
means.
143
141
144
142
``` r
145
- exdata_rr % > %
146
- dplyr :: group_by(exposure ) % > %
147
- dplyr :: summarise(m = mean(.unmeasured_confounder / sd(.unmeasured_confounder ))) % > %
143
+ exdata_rr | >
144
+ dplyr :: group_by(exposure ) | >
145
+ dplyr :: summarise(m = mean(.unmeasured_confounder / sd(.unmeasured_confounder ))) | >
148
146
tidyr :: pivot_wider(names_from = exposure ,
149
147
values_from = m ,
150
- names_prefix = " u_" ) % > %
148
+ names_prefix = " u_" ) | >
151
149
dplyr :: summarise(estimate = u_1 - u_0 )
152
150
```
153
151
@@ -168,7 +166,7 @@ mod_true <- glm(
168
166
data = exdata_rr ,
169
167
family = poisson )
170
168
171
- mod_true % > %
169
+ mod_true | >
172
170
broom :: tidy(exponentiate = TRUE , conf.int = TRUE )
173
171
```
174
172
@@ -203,14 +201,11 @@ tip_with_binary(effect_observed = 1.09,
203
201
unexposed_confounder_prev = 0.10 )
204
202
```
205
203
206
- ## ℹ The observed effect (1.09) WOULD be tipped by 1 unmeasured confounder with
207
- ## the following specifications:
208
- ## • estimated prevalence of the unmeasured confounder in the exposed population:
209
- ## 0.25
210
- ## • estimated prevalence of the unmeasured confounder in the unexposed
211
- ## population: 0.1
212
- ## • estimated relationship between the unmeasured confounder and the outcome:
213
- ## 1.64
204
+ ## The observed effect (1.09) WOULD be tipped by 1 unmeasured confounder
205
+ ## with the following specifications:
206
+ ## * estimated prevalence of the unmeasured confounder in the exposed population: 0.25
207
+ ## * estimated prevalence of the unmeasured confounder in the unexposed population: 0.1
208
+ ## * estimated relationship between the unmeasured confounder and the outcome: 1.64
214
209
215
210
## # A tibble: 1 × 6
216
211
## effect_adjusted effect_observed exposed_confounder_p…¹ unexp…² confo…³ n_unm…⁴
@@ -236,12 +231,11 @@ tip(effect_observed = 1.09,
236
231
confounder_outcome_effect = 1.05 )
237
232
```
238
233
239
- ## ℹ The observed effect (1.09) WOULD be tipped by 7 unmeasured confounders with
240
- ## the following specifications:
241
- ## • estimated difference in scaled means between the unmeasured confounder in the
242
- ## exposed population and unexposed population: 0.25
243
- ## • estimated relationship between the unmeasured confounder and the outcome:
244
- ## 1.05
234
+ ## The observed effect (1.09) WOULD be tipped by 7 unmeasured confounders
235
+ ## with the following specifications:
236
+ ## * estimated difference in scaled means between the unmeasured confounder
237
+ ## in the exposed population and unexposed population: 0.25
238
+ ## * estimated relationship between the unmeasured confounder and the outcome: 1.05
245
239
246
240
## # A tibble: 1 × 5
247
241
## effect_adjusted effect_observed exposure_confounder_effect confounde…¹ n_unm…²
@@ -266,19 +260,19 @@ function **broom** that can be directly fed into the `tip()` function.
266
260
``` r
267
261
if (requireNamespace(" broom" , quietly = TRUE ) && requireNamespace(" dplyr" , quietly = TRUE )) {
268
262
glm(outcome ~ exposure + measured_confounder , data = exdata_rr ,
269
- family = poisson ) % > %
270
- broom :: tidy(conf.int = TRUE , exponentiate = TRUE ) % > %
271
- dplyr :: filter(term == " exposure" ) % > %
272
- dplyr :: pull(conf.low ) % > %
263
+ family = poisson ) | >
264
+ broom :: tidy(conf.int = TRUE , exponentiate = TRUE ) | >
265
+ dplyr :: filter(term == " exposure" ) | >
266
+ dplyr :: pull(conf.low ) | >
273
267
tip(confounder_outcome_effect = 2.5 )
274
268
}
275
269
```
276
270
277
- ## ℹ The observed effect (1.09) WOULD be tipped by 1 unmeasured confounder with
278
- ## the following specifications:
279
- ## • estimated difference in scaled means between the unmeasured confounder in the
280
- ## exposed population and unexposed population: 0.09
281
- ## • estimated relationship between the unmeasured confounder and the outcome: 2.5
271
+ ## The observed effect (1.09) WOULD be tipped by 1 unmeasured confounder
272
+ ## with the following specifications:
273
+ ## * estimated difference in scaled means between the unmeasured confounder
274
+ ## in the exposed population and unexposed population: 0.09
275
+ ## * estimated relationship between the unmeasured confounder and the outcome: 2.5
282
276
283
277
## # A tibble: 1 × 5
284
278
## effect_adjusted effect_observed exposure_confounder_effect confounde…¹ n_unm…²
0 commit comments