Edit: If anyone is interested, I can upload a csv.
I'm using a coxph model in R to analyse data that look like this:
id year start stop event education household_position occupation urban
<dbl> <dbl> <dbl> <int> <dbl> <fct> <fct> <fct> <fct>
1 1860001 1965 0 1 0 elementary parent unskilled yes
2 1860001 1966 1 2 0 elementary parent unskilled yes
3 1860001 1967 2 3 0 elementary parent unskilled yes
4 1860001 1968 3 4 0 elementary parent unskilled yes
5 1860001 1969 4 5 0 elementary parent unskilled yes
6 1860001 1970 5 6 0 elementary parent unskilled yes
7 1860001 1971 6 7 0 elementary parent unskilled yes
8 1860001 1972 7 8 0 elementary parent unskilled yes
9 1860001 1973 8 9 0 elementary parent unskilled yes
10 1860001 1974 9 10 0 elementary parent unskilled yes
.
.
.
521 1900195 2020 15 16 0 elementary parent unskilled yes
522 1900196 2005 0 1 0 elementary parent white_collar no
523 1900196 2006 1 2 0 elementary parent white_collar no
524 1900196 2007 2 3 0 elementary parent white_collar no
525 1900196 2008 3 4 0 elementary parent white_collar no
526 1900196 2009 4 5 0 elementary parent white_collar no
527 1900196 2010 5 6 0 elementary parent white_collar no
528 1900196 2011 6 7 0 elementary parent white_collar no
529 1900196 2012 7 8 0 elementary parent white_collar no
530 1900196 2013 8 9 0 elementary parent white_collar no
It's about 13,000 rows in total with some time-variant covariates (occupation and urban). Using the finalfit() package, I wrote the following code:
explanatory <- c("education", "occupation", "urban", "household_position", "frailty(id)")
dependent <- c("Surv(start, stop, event)")
dat %>%
finalfit(dependent, explanatory)
The output is:
Dependent: Surv(start, stop, event) all HR (univariable) HR (multivariable)
education elementary 11477 (100.0) - -
higher 1250 (100.0) 2.25 (1.69-3.00, p<0.001) 2.70 (1.54-4.75, p=0.001)
unknown_or_little 337 (100.0) 1.28 (0.66-2.49, p=0.464) -
occupation unskilled 4665 (100.0) - -
skilled 1454 (100.0) 1.43 (1.03-1.98, p=0.033) 1.17 (0.75-1.81, p=0.492)
farmers 932 (100.0) 0.10 (0.02-0.39, p=0.001) 0.12 (0.03-0.51, p=0.004)
white_collar 899 (100.0) 1.13 (0.73-1.75, p=0.585) 0.64 (0.34-1.23, p=0.179)
elite 267 (100.0) 2.61 (1.55-4.39, p<0.001) 0.76 (0.33-1.76, p=0.516)
no_occupation 4847 (100.0) 0.71 (0.54-0.93, p=0.012) 0.77 (0.55-1.10, p=0.150)
urban no 10509 (100.0) - -
yes 2555 (100.0) 1.43 (1.11-1.85, p=0.005) 1.21 (0.87-1.68, p=0.264)
household_position parent 8422 (100.0) - -
child 3279 (100.0) 0.68 (0.52-0.91, p=0.009) 0.93 (0.65-1.33, p=0.694)
relative 300 (100.0) 0.39 (0.13-1.23, p=0.108) -
lodger 1063 (100.0) 1.56 (1.14-2.15, p=0.006) 1.51 (1.02-2.24, p=0.040)
frailty(id) - -
<NA> <NA> <NA> <NA> 1.26 (0.49-3.26, p=0.631)
<NA> <NA> <NA> <NA> 0.61 (0.17-2.14, p=0.442)
I'm unsure why not all HRs are shown in the columns HR (multivariable). HRs for relative and unknown_or_little I believe are shown next to frailty(id). When removing the frailty term, the HRs are presented the same way as all other factors. Is there a reason for why the HRs are not shown next to the factor names?