Equation for space-time model

51 views
Skip to first unread message

Stefan Siegert

unread,
Jun 9, 2021, 11:04:42 AM6/9/21
to R-inla discussion group
I am fitting a spatiotemporal Binomial model with an overall spatial effect, an overall temporal effect, and an interaction term using the group argument (adapted from a code example I found online):

inla(formula = y ~ -1 + 
                       f(i_time, model='rw2', constr=FALSE) +
                       f(i_spat, model='besag', graph=adj_graph) +
                       f(i_spat_2, model='iid',
                         group=i_time, control.group=list(model='ar1')),
  data = inla_data,
  family='binomial', Ntrials=n)

In my code I also constrain the hyperparameters of the iid and the ar1 models in the interaction term so that the interaction term is small. The results look reasonable. However, I'm not sure how I should write this model down mathematically. I guess I have something like

  y(s,t) ~ Bin(p(s,t))
  logit(p(s,t)) = f(s) + g(t) + h(s,t)
  f(s) ~ CAR1(s)
  g(t) ~ RW2(t)

But what is h?

Helpdesk

unread,
Jun 9, 2021, 11:08:24 AM6/9/21
to Stefan Siegert, R-inla discussion group

iid group ar1

is the same as

ar1 group iid


so that is for each i_spat_2, you have an ar1 process, and all
ar1'processes are (conditional) indendent.

I guess if you want a 'space time model', you would do

f(i_spat, model='besag', graph=adj_graph, group=i_time,
control.group=list(model='ar1'))


which replace i_spat and i_spat_2 in your formula
> --
> 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/8bb10fc0-3bd5-4b34-ab13-971475574224n%40googlegroups.com
> .

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

Stefan Siegert

unread,
Jun 9, 2021, 11:25:29 AM6/9/21
to R-inla discussion group
Thanks, very useful. Especially "iid group ar1" == "ar1 group iid" is something I was wondering about.

So is it correct that in my notation I would have

  h(s,t) ~ AR1(t) independent for all s = 1, ..., S

I noticed that when increasing the precision hyperparameter of the iid model shrinks the interaction terms h(s,t) towards zero. Can we then still say that the AR1s are conditionally independent?

How would the "besag group ar1" model you propose be written mathematically?

Helpdesk

unread,
Jun 9, 2021, 12:16:42 PM6/9/21
to Stefan Siegert, R-inla discussion group

math: its just a Kronecker product model

https://github.com/hrue/r-inla/tree/devel/internal-doc/group


conditionally independent, as they are independent conditionally on the
parameters in the AR1, and they all share the same hyperparmeters.

Stefan Siegert

unread,
Jun 9, 2021, 7:46:12 PM6/9/21
to R-inla discussion group
Fantastic! Thank you.
Reply all
Reply to author
Forward
0 new messages