About plotting exceedance probability from a spatio-temporal model

31 views
Skip to first unread message

GLORIA NKEM IBEH

unread,
Aug 13, 2025, 12:28:28 PMAug 13
to R-inla discussion group
I fitted spatio-temporal model and wanted to plot the exceedance probability but I found out that the list of  the marginal posterior distribution of fitted values   "marginals.fitted.values" is returning NULL value, how can I resolve this?  I have also tried to work with the  marginals of the linear predictor, transform them to the fitted value yet it did not work. Can anyone help me out on this
 here is my model:                                                                                                                               #Type 1(interaction between two unstructured effect)
formula.hosp.rw2.1A <- Incidence ~ 1 + CUMUL_vacc_rate*stringency_index+ logCASES +
f(provID, model="bym2",graph=grp,scale.model=TRUE) +
f(week_ID,model="rw2") +
f(week_id.1,model="iid") +
f(ID.prov.week,model="iid")  
covid.hosp.rw2.1A <- inla(formula.hosp.rw2.1A,family="poisson",
        data=data.set,E= expected_hosp,
        control.predictor=list(compute=TRUE, link =1), #enable prediction
        control.compute=list(dic=TRUE, cpo=TRUE),
        lincomb=lcs)
exc<-sapply(covid.hosp.rw2.1A$marginals.fitted.values,
 FUN =function(marg){1-inla.pmarginal(q =1,marginal =marg)})           

Johnson, Daniel P

unread,
Aug 13, 2025, 1:04:40 PMAug 13
to GLORIA NKEM IBEH, R-inla discussion group
control.compute = list(config = TRUE)

Daniel P. Johnson, Ph.D.
Associate Professor
Indiana University at Indianapolis
Department of Geography


From: r-inla-disc...@googlegroups.com <r-inla-disc...@googlegroups.com> on behalf of GLORIA NKEM IBEH <ibehg...@gmail.com>
Sent: Wednesday, August 13, 2025 12:28 PM
To: R-inla discussion group <r-inla-disc...@googlegroups.com>
Subject: [External] [r-inla] About plotting exceedance probability from a spatio-temporal model
 
You don't often get email from ibehg...@gmail.com. Learn why this is important

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

--
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/436f7946-769f-4d8c-9146-625f7ac05823n%40googlegroups.com.

GLORIA NKEM IBEH

unread,
Aug 13, 2025, 2:48:09 PMAug 13
to R-inla discussion group
Thank you  Johnson, Daniel P for your insight however, I tried it yet it did not work.

Helpdesk (Haavard Rue)

unread,
Aug 15, 2025, 8:42:50 AMAug 15
to GLORIA NKEM IBEH, R-inla discussion group

Note that the value of 'E' is not part of the fitted.values (its a part of the
likelihood...), but you can move 'E' into the linear predictor using argument

offset = log(expected_hosp)

instead of

E = expected_hosp

or add offset(log(expected_hosp)) to the formula

> y=10
> r=inla(y~1,data=data.frame(y), family="poisson")
> r$summary.fitted.values$mean
[1] 9.999991924
> r=inla(y~1,E=10, data=data.frame(y), family="poisson")
> r$summary.fitted.values$mean
[1] 0.9999991925
> r=inla(y~1,offset=log(10), data=data.frame(y), family="poisson")
> r$summary.fitted.values$mean
[1] 9.99998304
> r=inla(y~1 + offset(log(10)), data=data.frame(y), family="poisson")
> r$summary.fitted.values$mean
[1] 9.99998304




On Wed, 2025-08-13 at 11:48 -0700, GLORIA NKEM IBEH wrote:
> Thank you Johnson, Daniel P for your insight however, I tried it yet it did
> not work.
>
> On Wednesday, August 13, 2025 at 6:04:40 PM UTC+1 Johnson, Daniel P wrote:
> >
> >
> > control.compute = list(config = TRUE)
> >
> >
> >
> >
> > Daniel P. Johnson, Ph.D.
> > Associate Professor
> > Indiana University at Indianapolis
> > Department of Geography
> >
> > dpjo...@iu.edu
> >
> > 317-278-5536
> >
> >
> >
> >
> >
Håvard Rue
he...@r-inla.org
Reply all
Reply to author
Forward
0 new messages