Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I get gtsummary to exponentiate a weibull model?

I’m running a Weibull regression using the survreg function in the survival package.

I’d like to use gtsummary to then produce a table of the results.

But when I try to exponentiate the beta coefficient, it just returns me the same beta value – but says it’s exp(B) in the header.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

reprex:

library(survival)
library(gtsummary)

fit_w<-survreg(Surv(time, status) ~ sex, dist='weibull', data=lung)

tbl_regression(fit_w)

tbl_regression(fit_w,
               exponentiate=TRUE)

>Solution :

The default tidying function is broom::tidy.survreg() which does NOT have an exponentiate argument for survreg() models. The reason it is not there is because most of the models created with this function are NOT proportional hazards models, meaning that you should not exponentiate because the result is not a hazard ratio.

If you confidently feel like your model should have an exponentiated coef, then you can write a small wrapper for broom::tidy.survreg() that includes a exponentiate argument.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading