Closed davidbolin closed 3 years ago
This has been fixed at some point in the past. The syntax has also changed slightly (map
is now main
, and doesn't need to be named). Modified code below now tends to crash INLA instead, due to the flat field leading to large range and tiny variance, and non-positive-definit precision.
library(inlabru)
seed <- 1
obs.loc <- 10 * cbind(runif(100), runif(100))
Y <- as.vector(rnorm(100))
df <- data.frame(Y = Y, x = obs.loc)
x <- seq(from = 0, to = 10, length.out = 20)
mesh <- INLA::inla.mesh.create(
lattice = INLA::inla.mesh.lattice(x = x, y = x),
extend = FALSE,
refine = FALSE
)
spde2 <- INLA::inla.spde2.pcmatern(
mesh,
prior.range = c(1, 0.01),
prior.sigma = c(10, 0.01)
)
comp <- Y ~ field(s, model = spde2) + Intercept(1)
fit <- bru(comp, data = df, family = "gaussian")
The code below gives the following error, which seems to be caused by the name "s" for the coordinates.
library(inlabru) seed <- 1 obs.loc <- 10 * cbind(runif(100), runif(100)) Y <- as.vector(rnorm(100)) df <- data.frame(Y=Y,x=obs.loc) x <- seq(from = 0, to = 10, length.out = 30) mesh <- inla.mesh.create(lattice = inla.mesh.lattice(x = x, y = x), extend = FALSE, refine = FALSE) spde2 <- inla.spde2.pcmatern(mesh, prior.range=c(1, 0.01), prior.sigma=c(10, 0.01))
comp <- Y ~ field(map = s, model = spde2) + Intercept
fit <- bru(comp, df, family = "gaussian")