Reputation: 85
I want to regress several outcomes on a constant covariate. Like this (outcomes response resp. death regressed on trt):
library(gtsummary) # version 2.0.4
tbl_uvregression(
trial,
x = trt,
include = c(response, death),
method = glm,
method.args = list(family = binomial),
exponentiate = TRUE
)
So far, so good. But this is the univariate case; in real life, I need to adjust each regression for a confounder, say age. As far as I can see, I cannot do that with tbl_uvregression or any other function in the gtsummary universe. So I did it by hand:
# outcome = response
m1 <- glm(response ~ trt + age, data = trial, family = binomial)
t1 <- tbl_regression(m1, exponentiate = TRUE, include = trt, show_single_row = trt)
# outcome = death
m2 <- glm(death ~ trt + age, data = trial, family = binomial)
t2 <- tbl_regression(m2, exponentiate = TRUE, include = trt, show_single_row = trt)
tbl_stack(list(t1, t2))
This basically works, though the output does not look particularly great. For example, it does not show/label the outcome variables - how would I do that?
If anyone knows of a simpler approach, please let me know!
Upvotes: 0
Views: 52