Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Survival Analysis: support for inla.surv in formula #65

Open
DBecker7 opened this issue Oct 9, 2019 · 1 comment
Open

Survival Analysis: support for inla.surv in formula #65

DBecker7 opened this issue Oct 9, 2019 · 1 comment
Assignees

Comments

@DBecker7
Copy link

DBecker7 commented Oct 9, 2019

Minimal Example:

library(INLA)
library(inlabru)

data("veteran", package = "survival")
veteran$time.m <- round(veteran$time / 30, 3)

exp.vet <- inla(inla.surv(time.m, status) ~ 1,
    data = veteran, family = "exponential.surv")
summary(exp.vet)

# Attempted inlabru version:
exp.vet2 <- bru(components = inla.surv(time.m, status) ~ 1,
    family = like(family = "lognormal.surv",
        formula = inla.surv(time.m, status) ~ 1,
        data = veteran))
Error in eval.if.function(y, points) : unsupported data.

The error is generated by the make.stack() function, which sends as.data.frame(lhood$data)[, lhood$response] into the eval.if.function() function, which tests whether it's a function or if it's numeric. Since lhood$response is a character vector with the names in inla.surv() (in this case, "time.m" and "status"), the result is a data frame and thus it is neither numeric nor a function. The else in eval.if.function() is triggered, which reports the error.

@finnlindgren
Copy link
Collaborator

Thanks for the test case!

For future devel reference:
inla.surv() generates a list of variables, that converts survival type data into information needed by the .surv response models. Current inlabru code can only handle numeric vectors as observation variables, so it needs to be either extended to handle collections of vectors, or there needs to be a special like() feature to handle survival data, or a combination of those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants