Result discrepancies between MCMC (Rjags) and INLA for an exponential survival model

34 views
Skip to first unread message

wongfen...@gmail.com

unread,
Nov 15, 2021, 8:45:39 PM11/15/21
to R-inla discussion group
Dear Prof Rue and others,

First, thank you for your help previously. I have sucessfully installed the new INLA package and run it for a simple exponential survival model (one numerical covariate + intercept). Unfortunately, the results are different as given in the attachment.

I also include the dataset and the code used for both rjags and INLA packages. Hope to get further insights from you all. Thanks.

Razali
RJAGS and INLA codes - Exponential Survival Model.txt
Results.txt
Parkinson2.csv

Helpdesk

unread,
Nov 16, 2021, 2:27:53 AM11/16/21
to wongfen...@gmail.com, R-inla discussion group
your jags code is not correct in how it deals with cencoring.

n = 1000
x = rnorm(n, sd = 0.5)
lambda = exp(1+x)
yy = rexp(n, rate=lambda)
ys <- rexp(n, rate = exp(1))
y <- pmin(yy, ys)
event <- as.numeric(ys > yy)

data = list(y=y, event=event, x=x)
summary(inla(inla.surv(y,event) ~ x,
family ="exponential.surv",
control.family = list(link = list(model = "neglog")),
data=data))

library(survival)
summary(survreg(Surv(y, event) ~ x, data=data, dist="exponential"))
> --
> 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 on the web, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/2337c061-32a2-4bf1-a044-ea5419343be4n%40googlegroups.com
> .

--
Håvard Rue
he...@r-inla.org

wongfen...@gmail.com

unread,
Nov 16, 2021, 3:57:18 AM11/16/21
to R-inla discussion group

Hi Prof Rue,

Thank you for your reply. In this case, may I know what is the problem with the rjags codes and how should I correct them for censoring so that I will get the same results with INLA? I have implemented similar codes using the old INLA version (2018 version) and it seems they give the same answer? and how can I use survreg with my problem since priors cannot be specified using such function. Sorry for asking many questions. Thanks.

Helpdesk

unread,
Nov 16, 2021, 9:32:07 AM11/16/21
to wongfen...@gmail.com, R-inla discussion group
its discussed in the jags manual
Screenshot from 2021-11-16 17-31-35.png
Reply all
Reply to author
Forward
0 new messages