In predictor expressions, name_eval(...)
can be used to evaluate
the effect of a component called "name".
Examples
if (FALSE) { # \dontrun{
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))
)
}
} # }