inla.stack() failing

21 views
Skip to first unread message

Assa Mulagha-Maganga

unread,
Jul 8, 2026, 9:18:36 AM (13 days ago) Jul 8
to R-inla discussion group
Hi everyone,

in stack with the  inla.stack() function. Im getting the following error: 
Error in inla.ifelse(inherits(x, "inla.surv"), stop("inla.surv objects must be given as 'responses' input"), : inla.surv objects must be given as 'responses' input

I have attached the replication code.

Thanks in advance,

Assa


sample_INLA_code.R

Finn Lindgren

unread,
Jul 8, 2026, 11:48:26 AM (12 days ago) Jul 8
to Assa Mulagha-Maganga, R-inla discussion group
Hi,

as the error message says, you have to use the 'responses' argument with inla.stack() when involving inla.surv response objects.
Unfortunately there is no complete example for exactly how to use that feature.
I would strongly recommend you use the inlabru package interface instead of plain INLA for this, as inlabru removes the need for direct inla.stack() calls, and nlabru handles the inla.surv response objects automatically (precisely using the 'responses# argument to inla.stack() internally).

Manual use of inla.stack() should be considered a legacy feature that's still visible only to support old existing code. New code that would have needed it in the past (before inlabru 2.11.1 from 2024-07-01) is much better off using inlabru instead, as that's what it's for (it's one of the several reasons inlabru exists).

Finn

--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/r-inla-discussion-group/a92641d3-ee45-4dab-a190-282c69832005n%40googlegroups.com.


--
Finn Lindgren
email: finn.l...@gmail.com

Håvard Rue

unread,
Jul 9, 2026, 10:15:15 AM (11 days ago) Jul 9
to Finn Lindgren, Assa Mulagha-Maganga, R-inla discussion group

or use the new package, INLAjoint, for survival analysis which also handle joint
longitudianal and surv models
Håvard Rue
hr...@r-inla.org

Denis Rustand

unread,
Jul 9, 2026, 1:17:27 PM (11 days ago) Jul 9
to R-inla discussion group
Hello,

You can have a look at this book chapter for details on how to include spatial random effects within survival models using INLAjoint: https://rustand.fr/INLA_book/C5/chapter5.html

Best,
Denis Rustand
Reply all
Reply to author
Forward
0 new messages