extraconst for AR1 prior in Knorr-Held (2000) Type II

42 views
Skip to first unread message

Aminath Shausan

unread,
May 23, 2025, 2:43:00 AM5/23/25
to R-inla discussion group
 Hi, 
I am reaching out to get help with formulating the extraconst part in the Knorr-Held Type II interactions following the example code given here: https://github.com/aritz-adin/Identifiability_Constraints_article/blob/main/R/CARmodels_INLA.R 

The model used in that link is for RW1 temporal prior. If I implement that example for my use case with covariates, I get the following model: 

## formula for RW1
formula  <- O  ~  season + tas + dtr + RH +        
  f(ID.area, model="iid", constr=TRUE, hyper=list(prec=list(prior=sdunif))) + ## iid spatial random effect (nu_i)
  f(ID.month, model = 'ar1', constr=TRUE, hyper=list(prec=list(prior=sdunif)))+ #, AR1 temporal random effect (gamma_j)
  f(ID.area.month, model="generic0", Cmatrix=R, rankdef=r.def,
                 constr=TRUE, hyper=list(prec=list(prior=sdunif)),
                 extraconstr=list(A=A.constr, e=rep(0,S+T-2))

Here, S = number of regions; T= number of time points 
D1 <- diff(diag(T),differences=1)
Q.gammaRW1 <- as(t(D1)%*%D1,"Matrix")

R <- kronecker(Q.gammaRW2,diag(S))
r.def <- 2*S
A.constr <- kronecker(matrix(1,1,T),diag(S))
A.constr <- A.constr[-1,]


How do I formulate the A.constr matrix for AR1 and the e part in the extraconstr part? 
thank you

FU peter

unread,
May 25, 2025, 11:30:58 PM5/25/25
to Aminath Shausan, R-inla discussion group
It seems that AR1, like IID, does not need constr=TRUE, so "control.group" can be used to establish type II interaction?

Aminath Shausan <a.dhu...@gmail.com> 于2025年5月23日周五 14:43写道:
--
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/28afac24-6189-4387-be33-b688be90e132n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages