当前位置:网站首页>A row of code r shows the table of Cox regression model

A row of code r shows the table of Cox regression model

2022-07-07 04:49:00 Mrrunsen

In today's article , A function will be introduced , Realize one line of code Cox Table of regression model , As a memory and tribute to our predecessors !

First , Installation and loading related R package :   

#  install 
install.packages("gtsummary")
#  load 
library(gtsummary)
library(survival)

I will use {gtsummary} Data set in “trial”, First take a look at the overview :  

summary(trial)

 

next step , Build a Cox The regression model :  

cox_model <- coxph(Surv(ttdeath, death) ~ age + stage + trt, trial)

Last , Tabulate the above model results :   

tbl_regression(cox_model, exponentiate = TRUE)

All right. , Today's content is here .

If it helps , Remember to share it with those who need it

原网站

版权声明
本文为[Mrrunsen]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130747461539.html