Predicting with a rw2 + besag kronecker product model

72 views
Skip to first unread message

Stefan Siegert

unread,
Dec 2, 2021, 6:35:33 AM12/2/21
to R-inla discussion group
I have a spatio-temporal data set and want to fit a rw2 + besag kronecker product model, and use it to make predictions. For testing I started with an rw2 group iid model:

 inla(formula = Y ~ -1 + f(i_week, model='rw2', constr=FALSE,
                                             group=i_lad, control.group=list(model='iid')),
        data = d,
        family='binomial', Ntrials=d$n,
        control.predictor=list(compute=TRUE, link=1))

All data in the last week are NA and so are predicted by extrapolating the RW2 (hence the constr=FALSE). The results look as expected:

screenshot-20211202-11:18:01.png

Then I swapped out 'iid' for 'besag', to borrow strength from spatial neighbors, as in:

inla(formula = Y ~ -1 + f(i_week, model='rw2', constr=FALSE,
                                             group=i_lad, 
                                             control.group=list(model='besag', graph=lad_adj)),
        data = d,
        family='binomial', Ntrials=d$n,
        control.predictor=list(compute=TRUE, link=1))

The results change dramatically, and not in a good way:

screenshot-20211202-11:19:27.png

I think this has to do with the sum-to-zero constraint in the besag model. If so, is there any way to turn the constraint off inside control.group? (I tried control.group(..., constr=FALSE) but that didn't work.)

Any suggestions are welcome - many thanks in advance!

Finn Lindgren

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

I would suggest placing the more complex model as the "main" model instead, i.e. swap the besag and rw2 models, using rw2 as group model.

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/6cb74512-d15a-4d88-a845-79e9fa44344en%40googlegroups.com.


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

Helpdesk

unread,
Dec 4, 2021, 6:26:33 AM12/4/21
to Stefan Siegert, R-inla discussion group

I think you want to do this rw2 + besag, the other way around, group
besag with rw2


On Thu, 2021-12-02 at 03:35 -0800, Stefan Siegert wrote:
> I have a spatio-temporal data set and want to fit a rw2 + besag
> kronecker product model, and use it to make predictions. For testing I
> started with an rw2 group iid model:
>
>  inla(formula = Y ~ -1 + f(i_week, model='rw2', constr=FALSE,
>                                              group=i_lad,
> control.group=list(model='iid')),
>         data = d,
>         family='binomial', Ntrials=d$n,
>         control.predictor=list(compute=TRUE, link=1))
>
> All data in the last week are NA and so are predicted by extrapolating
> the RW2 (hence the constr=FALSE). The results look as expected:
>
> screenshot-20211202-11:18:01.png
>
> Then I swapped out 'iid' for 'besag', to borrow strength from spatial
> neighbors, as in:
>
> inla(formula = Y ~ -1 + f(i_week, model='rw2', constr=FALSE,
>                                              group=i_lad, 
>                                            
>  control.group=list(model='besag', graph=lad_adj)),
>         data = d,
>         family='binomial', Ntrials=d$n,
>         control.predictor=list(compute=TRUE, link=1))
>
> The results change dramatically, and not in a good way:
>
> screenshot-20211202-11:19:27.png
>
> I think this has to do with the sum-to-zero constraint in the besag
> model. If so, is there any way to turn the constraint off inside
> control.group? (I tried control.group(..., constr=FALSE) but that
> didn't work.)
>
> Any suggestions are welcome - many thanks in advance!
> --
> 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/6cb74512-d15a-4d88-a845-79e9fa44344en%40googlegroups.com
> .

--
Håvard Rue
he...@r-inla.org
Reply all
Reply to author
Forward
0 new messages