Description Usage Arguments Details Value Examples
Run inla
with new data and give list of new predictors' positions.
1 | augment_inla(.result, newdata)
|
.result |
|
newdata |
Dataframe of new data. The column with the response
(outcome, dependent variable) must be filled with |
Run inla
with new data to allow the use of summary.linear.predictor
,
summary.fitted.values
, marginals.linear.predictor
, etc. Then
put it in a list with the positions of the newdata described just below.
This function is necessary because INLA
always keep the original data,
as a result we constantly use the row position of the new data when extracting
linear predictors, expected predictors (fitted values), etc. More specifically,
this function will
merge data with newdata
create a vector with the newdata's position in the inla data
set control.predictor = list(compute = TRUE)
set offset <- NULL
to avoid error message
set control.compute = list(config = TRUE)
, otherwise
error from INLA::inla.posterior.sample
.
List with the following items
updated inla
object.
integer() of newdata positions.
1 2 3 4 5 6 7 8 9 10 11 12 | the_data <- data.frame(
x1 = rnorm(20, mean = 1, sd = 0.5),
x2 = rnorm(20, mean = 2, sd = 1),
sigma = rexp(20))
the_data$mu <- the_data$x1 + the_data$x2
the_data$y <- rnorm(nrow(the_data), mean = the_data$mu, sd = the_data$sigma)
the_inla <- INLA::inla(formula = y ~ x1 + x2, data = the_data)
# the new data used for fitted/predicted values
the_newdata <- data.frame(
x1 = modelr::seq_range(the_data$x1, n = 5),
x2 = modelr::seq_range(the_data$x2, n = 5))
augment_inla(the_inla, newdata = the_newdata)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.