1

I have derived a Mixed Effects Cox Model with coxme and I am trying to extract the result in a latex table. I see that texreg() does not work and I wonder whether there would be other alternatives.

Edu
  • 903
  • 6
  • 17
  • 2
    Have you tried the `xtable` package? Maybe [this thread](https://stackoverflow.com/questions/7780666/cox-regression-output-in-xtable-choosing-rows-columns-and-adding-a-confidence) will help. – LAP Nov 07 '17 at 13:42
  • Yes, it is not applicable for this type of objects. – Edu Nov 07 '17 at 13:54
  • 1
    I think extracting each of the components in the object and collapse them in a table seems to be a sensible solution. Thanks @LAP – Edu Nov 07 '17 at 14:07

1 Answers1

4

I really like the broom with pixiedust packages for this type of problem. Broom won't handle coxme objects out of the box, but a third package ehahelper provides functions for these objects.

# install ehahelper, not on cran
devtools::install_github('junkka/ehahelper')

Once installed do tidying

library(coxme)
library(ehahelper)
library(broom)
fit <- coxme(Surv(y, uncens) ~ trt + (1|center), eortc)
tidy_fit <- tidy(fit)
class(tidy_fit)
[1] "data.frame"
tidy_fit
  term  estimate  std.error statistic p.value  conf.low conf.high
1  trt 0.7086127 0.06424398     11.03       0 0.5826968 0.8345286

Once in a dataframe, you will be able to export to xtable, or use pixiedust within a markdown doc to pdf.

r.bot
  • 5,309
  • 1
  • 34
  • 45