Dear Prof. Muff and Prof. Lindgren, thank you very much for your answers.
Finn perfectly summarised my doubts, i.e. I don't understand why setting initial = -15 implies "fixing the precision to a large value". I think that is not the same behaviour as the "regular" models. For example, when I run a Gaussian model with INLA including an iid Gaussian random effect, then I need to set the precision of the hyperparameter of the Gaussian family to a large (and fixed) value; otherwise, I could face confounding effects:
# packages
library(INLA)
# simulate from the following model
# yi ~ N(b_0 + b_z * z, 1), i = 1, ..., 200
# z ~ N(0, 1); b_0 = 1; b_z = -1
set.seed(08032021)
n <- 200; b_0 <- 1; b_z <- -1
z <- rnorm(n)
mu <- b_0 + b_z * z
y <- rnorm(n, mu)
summary(inla(
formula = y ~ z,
data = list(y = y, z = z)
))
# If I add an iid Gausian random effect, then I need to set the precision of the
# gaussian family to a very large and fixed value, otherwise I think there are
# confouding effects.
ID <- 1:n
summary(inla(
formula = y ~ z + f(ID),
data = list(y = y, z = z, ID = ID),
control.family = list(
hyper = list(
prec = list(
initial = log(10e5),
fixed = TRUE
)
)
)
))
On the other hand, it looks like the behaviour of the classical measurement error model is the opposite:
# packages
library(INLA)
# Simulate data from the following model:
# 1) Regression model
# y_i ~ Pois(lambda_i), i = 1, ..., 500
# log(lambda_i) = b_0 + b_z * z + b_x * x
# 2) Exposure model
# x = a_0 + a_z * z + eps
# 3) Error model
# w = x + u
# where
# b_0 = 1, b_z = -1 and b_x = 1;
# a_0 = 1; a_z = -1
# z ~ N(0, 1); eps ~ N(0, 1); u ~ N(0, 1)
# Constants
set.seed(08032021)
n <- 500
b_0 <- 1; b_z <- -1; b_x <- 1
a_0 <- 1; a_z <- -1
# Exposure model
z <- rnorm(n)
eps <- rnorm(n)
x <- a_0 + a_z * z + eps
# Error model
u <- rnorm(n)
w <- x + u
# Regression model
lambda <- b_0 + b_z * z + b_x * x
y <- rpois(n, exp(lambda))
# Build the Y matrix
Y <- matrix(NA_real_, nrow = 3 * n, ncol = 3)
Y[1:n, 1] <- y
Y[n + 1:n, 2] <- 0
Y[2 * n + 1:n, 3] <- w
# Reformat the data
my_data <- list(
# Regression model
Y = Y,
b_0 = c(rep(1, n), rep(NA, 2 * n)),
b_z = c(z, rep(NA, 2 * n)),
b_x = c(1:n, rep(NA, 2 * n)),
weight_x = c(rep(1, n), rep(-1, n), rep(1, n)),
idx_x = c(rep(NA, n), 1:n, 1:n),
# Exposure model
a_0 = c(rep(NA, n), rep(1, n), rep(NA, n)),
a_z = c(rep(NA, n), z, rep(NA, n))
)
# Run the INLA model
summary(inla(
formula = Y ~ -1 +
f(b_x, copy = "idx_x", hyper = list(beta = list(param = c(0, 0.1), fixed = FALSE))) +
f(idx_x, weight_x, model = "iid", values = 1:500, hyper = list(
prec = list(initial = -15, fixed = TRUE)
)) +
b_0 + b_z + a_0 + a_z,
family = c("poisson", "gaussian", "gaussian"),
data = my_data
))
Just to be clear: I'm not saying that the code reported in the paper is wrong, but I just don't understand the influence and the effects of the precision parameter. Thank you very much for your assistance.
Andrea