Title: | Local Indicator of Stratified Power |
Version: | 0.1.0 |
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>. |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
URL: | https://ausgis.github.io/localsp/, https://github.com/ausgis/localsp |
BugReports: | https://github.com/ausgis/localsp/issues |
Depends: | R (≥ 4.1.0) |
Imports: | dplyr, gdverse, purrr, sdsfun, sf, tibble, tidyr |
Suggests: | automap, gstat, knitr, readr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2025-01-23 01:47:36 UTC; 31809 |
Author: | Jiao Hu |
Maintainer: | Wenbo Lv <lyu.geosocial@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-01-27 18:20:08 UTC |
local indicator of stratified power
Description
local indicator of stratified power
Usage
lisp(
formula,
data,
threshold,
distmat,
discvar = NULL,
discnum = 3:8,
discmethod = c("sd", "equal", "geometric", "quantile", "natural"),
cores = 1,
...
)
Arguments
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 |
Value
A tibble
.
Examples
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)