This function fits a spatial model using Gaussian random fields with INLA. The function is not intended to be used directly by the user, but documentation is included so that you can see the argument values that you might pass from fit_survey_sets(). It is called internally by fit_survey_sets().

fit_inla(dat, response = "present", n_knots = 50,
  family = "binomial", max_edge = c(20, 100), kmeans = FALSE,
  plot = FALSE, fit_model = TRUE, extend = list(n = 8, offset =
  -0.1), offset = c(5, 25), cutoff = 10, include_depth = TRUE,
  verbose = FALSE, debug = FALSE, trials = 10)

Arguments

dat

A data frame from scale_survey_predictors().

response

A character value representing the column name for the response variable.

n_knots

Number of knots in the mesh. Passed to stats::kmeans().

family

Family to pass on to INLA. Like we should be "binomial" or "gamma".

max_edge

Value to pass on to INLA::inla.mesh.2d().

kmeans

Logical for whether to use stats::kmeans() to calculate the knot locations before generating the mesh with INLA::inla.mesh.create() (if TRUE) or use INLA::inla.mesh.2d() if FALSE.

plot

Logical for whether the INLA mesh should be plotted.

fit_model

Logic for whether the model should be fitted. Useful for debugging. Will return NA in the model component if FALSE.

extend

Value to pass on to INLA::inla.mesh.create().

offset

Value to pass on to INLA::inla.mesh.2d().

cutoff

Value to pass on to INLA::inla.mesh.2d().

include_depth

Logical for whether to include depth as a predictor.

verbose

Logical for verbose output from INLA.

debug

Logical for debugging.

trials

Number of times to retry the model if it fails to fit.