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

Adding support for special response objects #93

Open
finnlindgren opened this issue Nov 26, 2020 · 0 comments
Open

Adding support for special response objects #93

finnlindgren opened this issue Nov 26, 2020 · 0 comments

Comments

@finnlindgren
Copy link
Collaborator

Code example from Haavard Rue for how to combine special response objects and multi-likelihood models in inla:

n <- 5
na <- rep(NA, n)
Y1 <- inla.mdata(c(1:n, na, na),  1)
Y2 <- inla.surv(c(na, 1:n, na), 1)
Y3 <- c(na, na, 1:n)
intercept <- as.factor(c(rep(1, n), rep(2, n), rep(3, n)))
data <- list(YY = list(Y1, Y2, Y3),
             intercept = intercept)
r <- inla(YY ~ -1 + intercept, data = data,
          control.inla = list(diagonal = 1),
          family = c("nmix", "exponentialsurv", "poisson"))

It looks like what inlabru needs to do is to

  1. Call inla.stack to join the response variables with the needed extra NA:s (already available)
  2. Call inla.mdata, inla.surv or nothing, on the corresponding column (or list element) of the NA-expanded columns from the stack, and join the results into a list.

Each special response class will likely need its own wrapper likelihood method in inlabru (like the "cp" Cox Process model implementation) since inlabru needs to do the actual calling of the special functions, not the user; they can only be called after joining the models (or special code to alter already created objects would be needed).

It will be more complicated if the other arguments to inla.mdata and inla.surv also need extra handling.

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

1 participant