| bru_eval | R Documentation |
Evaluate
bru_eval(
model,
state,
data = NULL,
data_extra = NULL,
input_comp = NULL,
comp_mappers = NULL,
predictor = NULL,
format = NULL,
used = NULL,
...
)
model |
A bru model |
state |
list of state lists, as generated by |
data |
A |
data_extra |
Additional data for the predictor evaluation |
input_comp |
Precomputed inputs list for the components |
comp_mappers |
Precomputed bm_list of full
( |
predictor |
A formula or a bru_pred_expr expression to be evaluated
given the posterior or for each sample thereof. The default ( |
format |
character; determines the storage format of predictor output. Available options:
|
used |
A |
... |
Additional arguments, unused. |
A matrix or list (see format) of evaluated predictor
expressions.
if (bru_safe_inla()) {
model <- bru_model(
as_bru_comp_list(~ 1 + x + field(idx,
model = "iid",
mapper = bm_index(5L)
)),
bru_obs(
y ~ Intercept + x + field,
family = "poisson",
data = data.frame(
y = rpois(5, 10), x = rnorm(5),
idx = c(1, 2, 3, 4, 5)
)
)
)
bru_eval(
model,
state = list(bru_state(model, property = "zeros")),
data = data.frame(x = rnorm(4), idx = 4:1)
)
bru_eval(
model,
state = list(list(
Intercept = 1, x = 2, field = c(0, 0, 0, 0, 0),
Precision_for_field = 1
)),
data = data.frame(x = rnorm(4), idx = 4:1)
)
bru_eval(
model,
state = list(list(
Intercept = 1, x = 2, field = c(0, 0, 0, 0, 0),
Precision_for_field = 1
)),
data = data.frame(x = rnorm(4), idx = 4:1),
predictor = new_bru_pred_expr(
~ list(a = Intercept + x + field, b = field_eval(c(5:7, 5:7)))
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.