Skip to contents

Function for robust interaction detector(RID) model.

Usage

rid(
  formula,
  data,
  discvar = NULL,
  discnum = NULL,
  minsize = NULL,
  overlaymethod = "and",
  cores = 1
)

Arguments

formula

A formula of RID model.

data

A data.frame, tibble or sf object of observation data.

discvar

Name of continuous variable columns that need to be discretized. Noted that when formula has discvar, data must have these columns. By default, all independent variables are used as discvar.

discnum

A numeric vector for the number of discretized classes of columns that need to be discretized. Default all discvar use 10.

minsize

(optional) The min size of each discretization group. Default all use 1.

overlaymethod

(optional) Spatial overlay method. One of and, or, intersection. Default is and.

cores

(optional) Positive integer(default is 1). If cores > 1, use parallel computation.

Value

A list of the RID model result.

interaction

the result of RID model

Note

For bivariate spatial interactions, use the RGD function and specify the type parameter as interaction.

The RID model requires at least \(2^n-1\) calculations when has \(n\) explanatory variables. When there are more than 10 explanatory variables, carefully consider the computational burden of this model. When there are a large number of explanatory variables, the data dimensionality reduction method can be used to ensure the trade-off between analysis results and calculation speed.

Please set up python dependence and configure GDVERSE_PYTHON environment variable if you want to run rid(). See vignette('RGDRID',package = 'gdverse') for more details.

References

Zhang, Z., Song, Y., Karunaratne, L., & Wu, P. (2024). Robust interaction detector: A case of road life expectancy analysis. Spatial Statistics, 59(100814), 100814. https://doi.org/10.1016/j.spasta.2024.100814

Author

Wenbo Lv lyu.geosocial@gmail.com

Examples

if (FALSE) { # \dontrun{
## The following code needs to configure the Python environment to run:
data('sim')
g = rid(y ~ ., data = sim %>% dplyr::select(-dplyr::any_of(c('lo','la'))),
        discvar = c("xa","xb","xc"), discnum = 4, cores = 6)
g
} # }