On Mon, 2012-09-17 at 13:44 +0200, INLA help wrote:
## to be pedantic, or in the case where there are factors or contrasts
## involved, here is a revised example. the issue is that the
## model.matrix() sets up the fixed effects, so we need to define the
## linear combinations exactly as it is done there. so we need to run
## it twice, really. (well, that is the easiest option).
n = 100
racewhite = 1:n
educate = 1:n
y = rnorm(n)
r = inla(y ~ 1 + racewhite*educate,
data = data.frame(racewhite, educate),
control.predictor = list(compute=TRUE))
## net effect of educate + racewhite:educate
lc = inla.make.lincombs(
educate= r$model.matrix[, "educate"],
"racewhite:educate" = r$model.matrix[, "racewhite:educate"])
rr = inla(y ~ 1 + racewhite*educate,
data = data.frame(racewhite, educate),
control.predictor = list(compute=TRUE),
lincomb = lc)