View source: R/prepare_inla_data_stack.R
prepare_inla_data_stack | R Documentation |
Prepare data stack for INLA
prepare_inla_data_stack(
input_data,
id_raster,
covariates,
use_covariates = TRUE,
covariates_sum_to_one = FALSE,
family = "binomial",
use_spde = TRUE,
spde_range_pc_prior = list(threshold = 0.1, prob_below = 0.05),
spde_sigma_pc_prior = list(threshold = 3, prob_above = 0.05),
spde_integrate_to_zero = TRUE,
mesh_max_edge = c(0.2, 5),
mesh_cutoff = 0.04,
use_nugget = TRUE,
nugget_pc_prior = list(threshold = 3, prob_above = 0.05),
use_admin_effect = FALSE,
admin_boundaries = NULL,
admin_pc_prior = list(threshold = 3, prob_above = 0.05)
)
input_data |
A data.frame with at least the following columns:
|
id_raster |
terra::SpatRaster with non-NA pixels delineating the extent of the study area |
covariates |
(list) Named list of all covariate effects included in the model,
typically generated by |
use_covariates |
( |
covariates_sum_to_one |
(logical, default FALSE) Should the input covariates be constrained to sum to one? Usually FALSE when raw covariates are passed to the model, and TRUE if running an ensemble (stacking) model. |
family |
( |
use_spde |
( |
spde_range_pc_prior |
(list) A named list specifying the penalized complexity prior for the SPDE range. The two named items are "threshold", the test threshold (set as a proportion of the overall mesh extent), and "prob_below", the prior probability that the value is BELOW that range threshold. The function automatically converts "threshold" from a proportion of the overall mesh extent into a distance. |
spde_sigma_pc_prior |
(list) A named list specifying the penalized complexity prior for sigma (standard deviation) of the SPDE object. The two named items are "threshold", the test threshold for the standard deviation, and "prob_above", the prior probability that sigma will EXCEED that threshold. |
spde_integrate_to_zero |
( |
mesh_max_edge |
( |
mesh_cutoff |
( |
use_nugget |
( |
nugget_pc_prior |
A named list specifying the penalized complexity prior for the
nugget term. The two named items are "threshold", the test threshold for the nugget
standard deviation, and "prob_above", the prior probability that the standard
deviation will EXCEED that threshold. Only used if |
use_admin_effect |
( |
admin_boundaries |
(sf object, default NULL) admin boundaries spatial
object. Only used if |
admin_pc_prior |
(list) A named list specifying the penalized complexity prior
for the admin-level IID term. The two named items are "threshold", the test threshold
for the standard deviation of admin-level effects, and "prob_above", the prior
probability that the standard deviation will EXCEED that threshold. Only used if
|
Creates the formatted input data to be used by the INLA model. For more information about penalized complexity priors, see Daniel Simpson's paper on the subject: \Sexpr[results=rd]{tools:::Rd_expr_doi("doi:10.1214/16-STS576")}
List containing the following items:
"mesh": The mesh used to approximate the latent Gaussian process
"spde": The SPDE object that will be used to fit the INLA model
"inla_data_stack": The data stack to be passed to INLA::inla()
"formula_string": The formula specification to be passed to INLA::inla()
fit_inla_model()
MbgModelRunner
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.