lisp | R Documentation |
local indicator of stratified power
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.