determine optimal spatial data discretization for individual variables
Source:R/loess.R
loess_optdiscnum.Rd
Function for determining optimal spatial data discretization for individual variables based on locally estimated scatterplot smoothing (LOESS) model.
Note
When increase_rate
is not satisfied by the calculation, increase_rate*0.1
is used first.
At this time, if increase_rate*0.1
is not satisfied again, the discrete number corresponding
to the highest Q-statistic is selected as a return.
Note that gdverse
sorts discnumvec
from smallest to largest and keeps qvec
in
one-to-one correspondence with discnumvec
.
References
Yongze Song & Peng Wu (2021) An interactive detector for spatial associations, International Journal of Geographical Information Science, 35:8, 1676-1701, DOI:10.1080/13658816.2021.1882680
Author
Wenbo Lv lyu.geosocial@gmail.com
Examples
data('sim')
3:10 %>%
purrr::map_dbl(\(.k) st_unidisc(sim$xa,.k) %>%
factor_detector(sim$y,.) %>%
{.[[1]]}) %>%
loess_optdiscnum(3:10)
#> discnum
#> 7