-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the default of adjust_coef_with_binary()
adjust linear model coef
#12
make the default of adjust_coef_with_binary()
adjust linear model coef
#12
Conversation
perfect! also make sure to add yourself to the description 🎉 |
Added myself as contributor ✅ |
Oops! It is actually way simpler than I thought, just rederived, it should just be the difference in prevalences between the groups.
@malcolmbarrett I rewent through the math this morning and realized it simplifies to basically the same equation as I wonder if we should have totally separate functions for linear models since they are so much cleaner? |
Interesting. re: your first point, similar but not exactly the same as is. This is what you meant, yeah? library(tipr)
# IPW estimates without unmeasured confounder
estimates <- c(estimate = -12.5, conf.low = -13.8, conf.high = -11.3)
x <- adjust_coef_with_binary(
unlist(estimates),
exposed_confounder_prev = 0.25,
unexposed_confounder_prev = .05,
confounder_outcome_effect = -8
)
y <- adjust_coef(
unlist(estimates),
exposure_confounder_effect = 0.25 - .05,
confounder_outcome_effect = -8
)
tibble::tibble(x = x$effect_adjusted, y = y$effect_adjusted)
#> # A tibble: 3 × 2
#> x y
#> <dbl> <dbl>
#> 1 -10.2 -10.9
#> 2 -11.5 -12.2
#> 3 -9.03 -9.7 Created on 2022-09-24 with reprex v2.0.2 |
Yeah I had done something weird where I substituted part of the other
equation where I shouldn’t have when deriving it, I’m pretty sure the
effect of change in prevalence should just be linear because for linear
regression that ends up being all that plays into the equation. I think
because p0 was so tiny it looked the same in both cases in this particular
example but it could look different for other values if that makes sense
On Sat, Sep 24, 2022 at 11:09 AM Malcolm Barrett ***@***.***> wrote:
Interesting. Similar but not exactly the same as is. This is what you
meant, yeah?
library(tipr)
# IPW estimates without unmeasured confounder
estimates <- c(estimate = -12.5, conf.low = -13.8, conf.high = -11.3)
x <- adjust_coef_with_binary(
unlist(estimates),
exposed_confounder_prev = 0.25,
unexposed_confounder_prev = .05,
confounder_outcome_effect = -8
)
y <- adjust_coef(
unlist(estimates),
exposure_confounder_effect = 0.25 - .05,
confounder_outcome_effect = -8
)
tibble::tibble(x = x$effect_adjusted, y = y$effect_adjusted)
#> # A tibble: 3 × 2
#> x y
#> <dbl> <dbl>
#> 1 -10.2 -10.9
#> 2 -11.5 -12.2
#> 3 -9.03 -9.7
Created on 2022-09-24 with reprex v2.0.2 <https://reprex.tidyverse.org>
—
Reply to this email directly, view it on GitHub
<#12 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAKSGPKH25C3I227CQDRDLV74KS3ANCNFSM6AAAAAAQUN3IPU>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
*Lucy D'Agostino McGowan, PhD*
Assistant Professor
Department of Statistical Sciences
Wake Forest University
✉️ ***@***.***
🌐 lucymcgowan.com <https://www.lucymcgowan.com>
|
That makes sense (and the two are identical when I use the updated code)! Ok, I tweaked it a little. This is a little silly, but I switched it to call Regarding your second point re: assumptions, that only affects the interpretation, correct? If that's the case, I think we should mention it in the docs (and book chapter) but that they don't need to be separated out |
I don't think that is silly! In fact maybe that is what we should kind of push people towards because that one fits a bit better under any scenario. I'm not sure the best way to word the docs now, but basically U ~ X + Z where Z are the other measured confounders -- with this U can be any distribution AND need not be independent from Z so way easier 😂 |
Created on 2022-09-23 with reprex v2.0.2