| bru_comp_eval | R Documentation |
In predictor expressions, name_eval(...) can be used to evaluate
the effect of a component called "name".
bru_comp_eval(
main,
group = NULL,
replicate = NULL,
weights = NULL,
.state = NULL
)
main, group, replicate, weights |
Specification of where to evaluate a
component. The four inputs are passed on to the joint list(core = list(
main = main,
group = group,
replicate = replicate),
scale = weights)
NOTE: If you have model component with the same name as a data variable you
want to supply as input to |
.state |
The internal component state. Normally supplied automatically by the internal methods for evaluating inlabru predictor expressions. |
A vector of values for a component
if (bru_safe_inla() &&
requireNamespace("sn", quietly = TRUE)) {
set.seed(12345L)
data <-
data.frame(
x = runif(5),
idx = seq_len(5)
)
data$y <- data$x + rnorm(5, sd = 0.1)
fit <- bru(
y ~ 0 + x + field(idx, model = "iid", mapper = bm_index(5L)),
family = "gaussian", data = data,
control.family = list(
hyper = list(prec = list(initial = 9, fixed = TRUE))
),
options = list(control.inla = list(int.strategy = "eb"))
)
pred <- generate(
fit,
newdata = list(),
formula = ~ field_eval(c(seq_len(5), 6, 7, 6)),
n.samples = 1L
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.