gd_bestunidisc {gdverse} | R Documentation |
best univariate discretization based on geodetector q-statistic
Description
Function for determining the best univariate discretization based on geodetector q-statistic.
Usage
gd_bestunidisc(
formula,
data,
discnum = NULL,
discmethod = NULL,
cores = 1,
return_disc = TRUE,
seed = 123456789,
...
)
Arguments
formula |
A formula of best univariate discretization. |
data |
A data.frame or tibble of observation data. |
discnum |
(optional) A vector of number of classes for discretization. Default is |
discmethod |
(optional) A vector of methods for discretization,default is using
|
cores |
(optional) A positive integer(default is 1). If cores > 1, a 'parallel' package cluster with that many cores is created and used. You can also supply a cluster object. |
return_disc |
(optional) Whether or not return discretized result used the optimal parameter.
Default is |
seed |
(optional) Random seed number, default is |
... |
(optional) Other arguments passed to |
Value
A list with the optimal parameter in the provided parameter combination with k
,
method
and disc
(when return_disc
is TRUE
).
x
the name of the variable that needs to be discretized
k
optimal discretization number
method
optimal discretization method
disc
optimal discretization results
Author(s)
Wenbo Lv lyu.geosocial@gmail.com
Examples
data('sim')
gd_bestunidisc(y ~ xa + xb + xc, data = sim,
discvar = paste0('x',letters[1:3]),
discnum = 3:6)