sss203
sss203

Reputation: 1

Exponentiate at different levels with tbl_regression in gtsummary

I would like to use tbl_regression in gtsummary to exponentiate for my ORs, but at different unit values. For example, I have a logistic regression model in which for some predictors I would like to express the OR per 5 or 10 unit increase (not just 1 unit increase). Is there anyway to do so?

Per my understanding of tbl_regression, I do not see a way to customize the exponentiate function.

Upvotes: 0

Views: 280

Answers (1)

Daniel D. Sjoberg
Daniel D. Sjoberg

Reputation: 11754

It is possible from within gtsummary, but it gets more complicated with exponentiation. I recommend just handling this before the model is passed to tbl_regression(). See example

library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.7.0'

glm(response ~ identity(age/10) + grade, data = trial, family = binomial) |> 
  tbl_regression(
    exponentiate = TRUE,
    label = list("identity(age/10)" = "Age per 10yrs")
  ) |> 
  as_kable() # convert to kable to display on StackOverflow
Characteristic OR 95% CI p-value
Age per 10yrs 1.21 0.97, 1.52 0.10
Grade
I
II 0.85 0.39, 1.85 0.7
III 1.01 0.47, 2.16 >0.9

Created on 2023-03-01 with reprex v2.0.2

Upvotes: 0

Related Questions