1

I'm getting an error from the Cox's survival model provided in Zelig.

Here's an example using dummy data:

require(survival)
require(Zelig)
dat <- data.frame(survival = rnorm(1000, 100, 20), event = c(rep(1, 200), rep(0, 800)), ind = sample(rep(c("A","B","C"), 1000 * c(0.3, 0.3, 0.4)), 1000))
zelig(Surv(survival, event) ~ ind, model = "coxph", data = dat)

This gives the error:

Error in eval(expr, envir, enclos) : attempt to apply non-function

This also happens with my real data.

Can anyone see what I'm doing wrong?

Hack-R
  • 22,422
  • 14
  • 75
  • 131
Dan Lewer
  • 871
  • 5
  • 12
  • 1
    This is a tricky one. Apparently it even stumped Harvard: http://comments.gmane.org/gmane.comp.lang.r.zelig/796 They opened a GitHub ticket about it but that was 4 years ago and the ticket is gone now. Though in that case they used `model="relogit"` and they were guessing that it was a bug in relogit... – Hack-R Jun 30 '16 at 22:18
  • Thanks... I guess I might have to use a different approach then! Zelig was attractive because it takes multiple imputed datasets, but there are more manual options... – Dan Lewer Jun 30 '16 at 22:27
  • Yea, I found that if I change the model type I don't get that error, yet I can run `survival::coxph()` with the same formula and it runs fine. So this has to be some deeply technical bug in the package, but if you open a GitHub ticket they will probably quickly respond. https://github.com/IQSS/Zelig/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20 – Hack-R Jun 30 '16 at 22:30
  • 1
    OK, great. I've opened a ticket. I'll post any updates here too. – Dan Lewer Jun 30 '16 at 23:00
  • Got an answer - https://github.com/IQSS/Zelig/issues/143 - 'Zelig 5 unfortunately doesn't support coxph. We'll be working on reintroducing support'. – Dan Lewer Feb 08 '17 at 22:13
  • well at least now we know. – Hack-R Feb 08 '17 at 22:14

0 Answers0