if (FALSE) {
if (bru_safe_inla()) {
mesh <- fmesher::fm_mesh_2d_inla(
cbind(0, 0),
offset = 2, max.edge = 0.25
)
spde <- INLA::inla.spde2.pcmatern(mesh,
prior.range = c(0.1, 0.01),
prior.sigma = c(2, 0.01)
)
data <- sp::SpatialPointsDataFrame(
matrix(runif(10), 5, 2),
data = data.frame(z = rnorm(5))
)
fit <- bru(z ~ -1 + field(coordinates, model = spde),
family = "gaussian", data = data
)
pred <- predict(
fit,
data = data.frame(x = 0.5, y = 0.5),
formula = ~ field_eval(cbind(x, y))
)
}
}
Run the code above in your browser using DataLab