Spatial stratified heterogeneity test based on geographic detector.
Arguments
- formula
A formula of spatial stratified heterogeneity test.
- data
A data.frame or tibble of observation data.
- type
(optional) The type of geographical detector,which must be one of
factor
(default),interaction
,risk
,ecological
.- ...
(optional) Specifies the size of the alpha (confidence level).Default is
0.95
.
Author
Wenbo Lv lyu.geosocial@gmail.com
Examples
ssh.test(y ~ x1 + x2,
tibble::tibble(y = 1:7,
x1 = c('x',rep('y',3),rep('z',3)),
x2 = c(rep('a',2),rep('b',2),rep('c',3))))
#> Spatial Stratified Heterogeneity Test
#>
#> Factor detector
#>
#> ----------------------------------
#> variable Q-statistic P-value
#> ---------- ------------- ---------
#> x2 0.8929 0.03168
#>
#> x1 0.7714 0.07936
#> ----------------------------------
#>
ssh.test(y ~ x1 + x2,
tibble::tibble(y = 1:7,
x1 = c('x',rep('y',3),rep('z',3)),
x2 = c(rep('a',2),rep('b',2),rep('c',3))),
type = 'interaction')
#> Spatial Stratified Heterogeneity Test
#>
#> Interaction detector
#>
#> ------------------------------------------
#> Interactive variable Interaction
#> ---------------------- -------------------
#> x1 ∩ x2 Weaken, nonlinear
#> ------------------------------------------
#>
ssh.test(y ~ x1 + x2,
tibble::tibble(y = 1:7,
x1 = c('x',rep('y',3),rep('z',3)),
x2 = c(rep('a',2),rep('b',2),rep('c',3))),
type = 'risk',alpha = 0.95)
#> Spatial Stratified Heterogeneity Test
#>
#> Risk detector
#>
#> --------------------------------------
#> Variable x1:
#>
#> | |x |y |z |
#> |:--|:--|:---|:---|
#> |x |NA |No |No |
#> |y |No |NA |Yes |
#> |z |No |Yes |NA |
#> --------------------------------------
#> Variable x2:
#>
#> | |a |b |c |
#> |:--|:---|:---|:---|
#> |a |NA |No |Yes |
#> |b |No |NA |Yes |
#> |c |Yes |Yes |NA |
ssh.test(y ~ x1 + x2,
tibble::tibble(y = 1:7,
x1 = c('x',rep('y',3),rep('z',3)),
x2 = c(rep('a',2),rep('b',2),rep('c',3))),
type = 'ecological',alpha = 0.95)
#> Spatial Stratified Heterogeneity Test
#>
#> ecological detector
#>
#> --------------------------------------
#>
#>
#> | |x2 |
#> |:--|:--|
#> |x1 |No |