sjPlot icon indicating copy to clipboard operation
sjPlot copied to clipboard

Combining uni- and multivariable analysis in tab_model

Open martinschlund opened this issue 4 years ago • 0 comments

Hi

Rather new in here, so please bear with my ignorance :-).

I wonder if it is possible for tab_model to combine the univariable estimates in a single column like finalfit() does:

library(sjPlot)
library(finalfit)
library(survival)
library(riskRegression)

data(Melanoma)

explanatory = c('sex', 'age')
dependent = 'Surv(time, status ==1)'

Melanoma %>% 
finalfit(dependent, explanatory) #produces table that combines estimates from uni- and multivariable analyses

#tried below but univariable estimates for Sex and Age get different columns.

coxSex <- coxph(Surv(time, status == 1)~sex, data = Melanoma)
coxAge <- coxph(Surv(time, status == 1)~age, data = Melanoma)
coxMulti <- coxph(Surv(time, status == 1)~age + sex, data = Melanoma)

tab_model(coxSex, coxAge, coxMulti)

The reason I would like to switch to sjPlot and tab_model is the more flexible interface allowing for splines and so forth, I looked through the help files and in the issues here and did not find a solution.

Looking forward to your reply and thank you for a great package.

Best regards

Martin

martinschlund avatar Feb 02 '21 16:02 martinschlund