I have a space-time model with an svc and a simple, zero-centered iid term added. I want to make spatial predictions on a separate prediction stack and have created the prediction grid with x, y, group, covariate values, etc.; projector A matrices for spatial terms; index sets for spatial terms; and stacked it all successfully. I want to ignore the iid for the spatial predictions, so I put an NA in the prediction grid for that term.
QUESTION: While I tried using an NA, I am not sure what to put in the prediction grid for the iid random effect. If it was an intercept, I'd put a 1. If it were a covariate, I'd put the covariate value of interest. But what do you put in for a zero-centered iid effect, both if you have a particular value you want to put in, but mostly if you want to ignore it because it is zero centered. Is it NA? Zero? The integer value for the level where the random effect is closest to zero?
formula_iid <- y ~ 0 +
f(eps, model = spde, constr=F) +
f(alpha, model = spde, constr=F, group = alpha.group,
control.group = list(model = "ar1", hyper = ar_prior)) +
f(gamma_iid, model = "iid", constr=T, hyper = pc_prior)
# top of prediction grid
> head(pred_grd)
y x group log_field_hours gamma_iid
[1,] -1469.231 1005.589 1 0 NA
[2,] -1433.296 1005.589 1 0 NA
[3,] -1397.361 1005.589 1 0 NA
[4,] -1361.426 1005.589 1 0 NA
[5,] -1325.491 1005.589 1 0 NA
[6,] -1289.556 1005.589 1 0 NA
# prediction stack
stk.p <- inla.stack(
tag = "pred",
data = list(y = rep(NA, nrow(pred_grd))), # use pred_grd
A = list(A_alpha_p, 1, A_eps_p, A_gamma_p, 1),
effects = list(alpha = idx_alpha,
b0 = rep(1, nrow(pred_grd)),
eps = idx_eps,
gamma = idx_gamma,
gamma_iid = pred_grd[, 4]) # use pred_grd
)