Learn R Programming

gdverse (version 1.1.0)

rid: robust interaction detector(RID) model

Description

Function for robust interaction detector(RID) model.

Usage

rid(
  formula,
  data,
  discvar = NULL,
  discnum = 10,
  overlay = "intersection",
  minsize = 1,
  cores = 1
)

Value

A list.

interaction

the result of RID model

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.

overlay

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

minsize

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

cores

(optional) Positive integer (default is 1). When cores are greater than 1, use multi-core parallel computing.

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

Examples

Run this code
if (FALSE) {
## The following code needs to configure the Python environment to run:
data('sim')
g = rid(y ~ .,
        data =  dplyr::select(sim,-dplyr::any_of(c('lo','la'))),
        discnum = 4, cores = 6)
g
}

Run the code above in your browser using DataLab