could not find function "plot_inla_residuals"

92 views
Skip to first unread message

Mike

unread,
Oct 29, 2021, 5:21:15 PM10/29/21
to R-inla discussion group
Hi all,

I am trying to get residuals plots from my INLA analyses and have tried using the plot_inla_residuals function, but I always get an error with the description: could not find function "plot_inla_residuals." Is this function still available in the package? If not, is there a way to compute residuals from my fitted models?

Thank you,
Mike

Nicola Criscuolo

unread,
Dec 2, 2021, 6:33:30 AM12/2/21
to R-inla discussion group
Hello Mike

I also could not find such function anymore. In addition, I would like to understand how to correctly calculate residuals from an INLA model where my outcome follows a Poisson distribution. Is it ok to just subtract the observed from the fitted values and check the residuals variance?

Thanks for your help and best regards,

Nico

Finn Lindgren

unread,
Dec 2, 2021, 9:25:00 AM12/2/21
to R-inla discussion group
Hi,

the plot_inla_residuals function has never been part of the INLA package itself. It seems to come from the INLAutils package, see https://github.com/timcdlucas/INLAutils

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 on the web, visit https://groups.google.com/d/msgid/r-inla-discussion-group/c6f27a6b-d4a6-4962-a658-bfb5b5926c1en%40googlegroups.com.


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

Helpdesk

unread,
Dec 4, 2021, 6:22:17 AM12/4/21
to Nicola Criscuolo, R-inla discussion group
the concept of 'residuals' is a bit different in the Bayesian context,
but classical Pearson type residuals, you can compute like attached, if
you ignore the philosofical differences.

An alternative is to use the PIT values

Best
H
> --
> 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/c6f27a6b-d4a6-4962-a658-bfb5b5926c1en%40googlegroups.com
> .

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

Nicola Criscuolo

unread,
Dec 4, 2021, 7:39:04 AM12/4/21
to R-inla discussion group
Thank you very much both for your help and your clarifications!

Best,

Nico

Wen FU

unread,
Dec 8, 2021, 9:40:19 AM12/8/21
to R-inla discussion group
Dear all.

Thanks Nico for asking this question, I was also looking for the answer to 'residuals'

However, I have used 'family = ''Exponential'' in the inla formula and I have checked the script of 'Poisson' shared by Havard.
I would like to ask how to modify the following inla formula for exponential prediction?
r = inla(formula,family="exponential",data=Germany, E=E,
          inla.mode = "experimental",
          control.compute = list(cpo = TRUE),
          control.predictor = list(compute = TRUE, link = 1))

The following is the correct way to calculate the classical Pearson residuals for exponential distribution?
pred.mean <- 1/ Germany$E * r$summary.fitted.values$mean
pred.sd <- 1/ Germany$E * r$summary.fitted.values$sd
pearson.residuals <- (Germany$Y - pred.mean)/pred.sd

Do you have any scripts to calculate the PIT values for 'exponential distribution'?

Thank you in advance for replying!

Bests,

Wen
Reply all
Reply to author
Forward
0 new messages