Conducts spatial gradient screening.

spatial_gradient_screening(
  coords_df,
  variables,
  resolution,
  cf = 1,
  rm_zero_infl = TRUE,
  n_random = 10000,
  sign_var = "fdr",
  sign_threshold = 0.05,
  skip_comp = FALSE,
  force_comp = FALSE,
  model_subset = NULL,
  model_add = NULL,
  model_remove = NULL,
  control = NULL,
  seed = 123,
  verbose = TRUE
)

Arguments

coords_df

A data.frame that contains at least a numeric variable named dist as well the numeric variables denoted in variables.

variables

Character vector of numeric variable names that are integrated in the screening process.

resolution

Units value of the same unit of the dist variable in coords_df.

n_random

Number of random permutations for the significance testing of step 2.

sign_var

Either p_value or fdr. Defaults to fdr.

sign_threshold

The significance threshold. Defaults to 0.05.

control

A list of arguments as taken from stats::loess.control(). Default setting is stored in SPATA2::sgs_loess_control.

seed

Numeric value. Sets the random seed.

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

Value

A list of four slots:

  • variables: A character vector of the names of all variables included in the screening.

  • model_df: A data.frame of the models used for step 3.

  • loess_models: A named list of loess models for all variables integrated in the screening process. Names correspond to the variable names.

  • pval: Data.frame of three variables: variable, lds, p_value and fdr. Contains the results of step 2. Each observation corresponds to the inferred gradient of a variable.

  • eval: Data.frame of five variable: variable, model, corr, mae rmse. Contains the results of step 3. Each observation corresponds to a gradient ~ model fit. Variables correspond to the evaluation metrics of the fit.