Hi all,
I'm currently trying to develop a space-time model, following the examples in Blangiardo and Cameletti's book. If we use Besag and RW1, the code for the four interaction types is as follows:
ID.area=ID.area2
ID.year=ID.year2=ID.year3
Type I:
results<- y~1+ f(ID.area, model="bym", graph=area.adj) +
f(ID.year, model="rw1") +
f(ID.year2,model="iid") +
f(ID.area.year, model="iid")
Type II:
results<- y~1+ f(ID.area, model="bym", graph=area.adj) +
f(ID.year, model="rw1") +
f(ID.year2, model="iid") +
f(ID.area2, model="iid", group=ID.year3,
control.group=list(model="rw1"))
Type III:
results<- y ~ 1+f(ID.area, model="bym", graph=area.adj) +
f(ID.year, model="rw1") +
f(ID.year2, model="iid") +
f(ID.year3, model="iid", group=ID.area2,
control.group=list(model="besag", graph=area.adj))
Type IV:
results<- y~1+f(ID.area, model="bym", graph=area.adj) +
f(ID.year, model="rw1") +
f(ID.year2, model="iid") +
f(ID.area2, model="besag", graph=area.adj,
group=ID.year3,
control.group=list(model="rw1"))
I noticed that there is no explicit discussion of the code. For example, for constraints, it's straightforward to apply constr=TRUE in the spatial and temporal components, . But I'm uncertain how constraints should be specified in the interactions.
Therefore, I would like to ask the following questions:
1. For Type I interaction, I understand that applying constr=TRUE is sufficient to impose sum-to-zero constraints. However, for Type II and III interactions, is it also valid to rely solely on constr=TRUE? In some previous discussions, I noticed that for Type IV interaction, in addition to constr=TRUE, an extraconstr is required. Does the also apply to Type II and III? Furthermore, if the RW1 terms are replaced with RW2, is it necessary to add one more constraint via extraconstr?
2. In addition, for both spatial and temporal main effects, hyperparameters are typically specified (e.g., f(year, model="rw1", hyper=list(theta=list('PCprior', c(1, 0.01))))), should the
hyperparameters be defined for the interaction terms? My intuition is that the
hyperparameters specification for interaction terms may be complex.
3. I often use scale.model=TRUE when using BYM or RW components. However, this option does not seem to be directly applicable toe interaction terms. What could be the reason for this?
Thank you in advance for your help!
Best wishes,
Jingjing