constraints in Knorr-Held Type IV

94 views
Skip to first unread message

Jessica Godwin

unread,
Jul 10, 2019, 11:11:12 AM7/10/19
to R-inla discussion group
Hi,

I'm curious about how to specify constraints in a Type IV interaction using the group = specification. I have area indexes area.id = 1:47 and time indexes time.id = 1:7, and a covariate x.

I'm currently specifying the Type IV interaction in the following way:

f(area.id, x, model = 'besag', graph = adj.matrix, scale.model = T, group = time.id, control.group = list(model = 'rw2'))

I know I can specify constr = T inside f(), but I don't know what that specifies in this case. Without the group argument it would be a sum-to-zero constraint over the random effects for each area. Is there any way to specify the sum-to-zero across space and across time? I tried to create an extra constraint for the extraconstr argument, but then I get an error because my A matrix's second dimension is (47*7) and not 47 (the length of area.id). I have implemented this previously for some other work in rgeneric(), but I would like to avoid using that as the incompatibility between rgeneric and updated R restricts the different computing resources I can use.

Thanks!

Elias T. Krainski

unread,
Jul 11, 2019, 7:19:45 AM7/11/19
to r-inla-disc...@googlegroups.com

Hi,

There are some ways to do this. For example using the 'generic0' model with the set of needed constraints passed into the argument extraconstr (see cwb-example.R for an example available into the r/ directory at http://www.leg.ufpr.br/~elias/cursos/br2015/

There is some work in the inla.knmodels() function. Setting type='4' adds a spacetime type IV interaction model.

However, for spacetime varying covariate effect, x as second argument in your f() call. The need of spatial and temporal constraints is actually only in case you also have 'x' coefficients varying over time plus 'x' coefficients varying over time as well. So you can follow the example in the link above and add 'x' as second argument. The extraconstr will remains the same as long as you have the time and spatial varying.

Elias

--
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 post to this group, send email to r-inla-disc...@googlegroups.com.
Visit this group at https://groups.google.com/group/r-inla-discussion-group.
To view this discussion on the web, visit https://groups.google.com/d/msgid/r-inla-discussion-group/41a70e64-781d-4341-857e-1c40c519b147%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages