Fit an INLA model based on a constructed data stack and formula
Usage
fit_inla_model(
formula,
data_stack,
spde,
samplesize_vec = 1,
precision_vec = 1,
family = "binomial",
link = "logit",
fixed_effects_pc_prior = list(threshold = 3, prob_above = 0.05),
verbose = TRUE
)
Arguments
- formula
(character) INLA formula to fit. Generated in
prepare_inla_data_stack()
, then interpreted usingstats::as.formula()
within the call toINLA::inla()
.- data_stack
Stacked data, covariates, and spatial index. Generated in
prepare_inla_data_stack()
.- spde
SPDE object generated by
prepare_inla_data_stack()
.- samplesize_vec
(
integer(N)
, default 1) Sample sizes for each data observation. Only used for binomial data models.- precision_vec
(
numeric(N)
, default 1) Precision for each data observation. Only used for gaussian data models.- family
(character, default 'binomial') GLM family to use. For more information, see
stats::family()
.- link
(character, default 'logit') Link function to use, typically related to the GLM
family
.- fixed_effects_pc_prior
A named list specifying the penalized complexity prior for all fixed effects except for the intercept. The two named items are "threshold", the test threshold for the size of each fixed effect, and "prob_above", the prior probability that the beta for each covariate will EXCEED that threshold.
- verbose
(
logical(1)
, default TRUE) Log progress for INLA model fitting?
Value
A fitted INLA model object created by INLA::inla()
Details
Using INLA::inla()
with reasonable defaults and settings tuned to predict
across a grid.