Title: | Local Indicator of Stratified Power |
---|---|
Description: | Implements a local indicator of stratified power to analyze local spatial stratified association and demonstrate how spatial stratified association changes spatially and in local regions, as outlined in Hu et al. (2024) <doi:10.1080/13658816.2024.2437811>. |
Authors: | Jiao Hu [aut, cph] , Wenbo Lv [aut, cre] , Yongze Song [aut] |
Maintainer: | Wenbo Lv <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2025-01-28 01:25:20 UTC |
Source: | https://github.com/ausgis/localsp |
local indicator of stratified power
lisp( formula, data, threshold, distmat, discvar = NULL, discnum = 3:8, discmethod = c("sd", "equal", "geometric", "quantile", "natural"), cores = 1, ... )
lisp( formula, data, threshold, distmat, discvar = NULL, discnum = 3:8, discmethod = c("sd", "equal", "geometric", "quantile", "natural"), cores = 1, ... )
formula |
A formula. |
data |
The observation data. |
threshold |
The distance threshold employed to select "local" data. |
distmat |
The distance matrices. |
discvar |
(optional) Name of continuous variable columns that need to be discretized. Noted
that when |
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) Positive integer (default is 1). When cores are greater than 1, use multi-core parallel computing. |
... |
(optional) Other arguments passed to |
A tibble
.
gtc = readr::read_csv(system.file("extdata/gtc.csv", package = "localsp")) gtc # Sample 100 observations from the original data to save runtime; # This is unnecessary in practice; set.seed(42) gtc1 = gtc[sample.int(nrow(gtc),size = 100),] distmat = as.matrix(dist(gtc1[, c("X","Y")])) gtc1 = gtc1[, -c(1,2)] gtc1 # Use 2 cores for parallel computing; # Increase cores in practice to speed up; lisp(GTC ~ ., data = gtc1, threshold = 4.2349, distmat = distmat, discnum = 3:5, discmethod = "quantile", cores = 2)
gtc = readr::read_csv(system.file("extdata/gtc.csv", package = "localsp")) gtc # Sample 100 observations from the original data to save runtime; # This is unnecessary in practice; set.seed(42) gtc1 = gtc[sample.int(nrow(gtc),size = 100),] distmat = as.matrix(dist(gtc1[, c("X","Y")])) gtc1 = gtc1[, -c(1,2)] gtc1 # Use 2 cores for parallel computing; # Increase cores in practice to speed up; lisp(GTC ~ ., data = gtc1, threshold = 4.2349, distmat = distmat, discnum = 3:5, discmethod = "quantile", cores = 2)