gd_bestunidisc {gdverse} | R Documentation |
Function for determining the best univariate discretization based on geodetector q-statistic.
gd_bestunidisc(
formula,
data,
discnum = 3:22,
discmethod = c("sd", "equal", "pretty", "quantile", "fisher", "headtails", "maximum",
"box"),
cores = 1,
return_disc = TRUE,
seed = 123456789,
...
)
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 |
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
Wenbo Lv lyu.geosocial@gmail.com
data('sim')
gd_bestunidisc(y ~ xa + xb + xc, data = sim,
discvar = paste0('x',letters[1:3]),
discnum = 3:6)