LID | R Documentation |
Calculate dispersion indexes according to a given set of standards and expectations (Mejia Ramon and Munson 2023), obtaining group, non-group, and total values for local observations and the global dataset.
LID(
x,
w,
index = "gini",
expect = "self",
standard = "global",
n = rep(1, length(x)),
mle = "mean",
fun.name = paste0(index, "q"),
type = "spatial",
max.cross = .Machine$integer.max,
canonical = FALSE,
pb = FALSE,
clear.mem = TRUE
)
x |
A vector values |
w |
A weights matrix of dimensions |
index |
A character string, either 'gini' (the default), or 'inoua', representing
whether distances are calculated in L1 or L2 space, respectively. Alternatively,
a numeric representing to what value distances and means are raised to when the
index is calculated. |
expect |
Either a character string or a matrix with dimensions |
standard |
Either a character string or a matrix with dimensions |
n |
A vector representing population weights. How much of an impact does a given
observation have on any other observation regardless of its influence as provided
for in |
mle |
Character string identifying the maximum likelihood estimator to be used.
Default is |
fun.name |
If |
type |
A character string, either the name or corresponding code of a particular standard-expectation pair, as defined in #Link to Mejia Ramon and Munson 2023# |
max.cross |
When processing, what is the maximum number of rows that
an internal data.table can have? This is generally not a concern unless
the number of observations approaches |
canonical |
Should the canonical Gini or Inoua value also be calculated?
Default is |
pb |
Logical. Should a progress bar be displayed? Default is |
clear.mem |
Logical. Should |
The output list can be passed to inferLID
to determine
whether the values are locally and globally higher or lower than would be
expected if other values were randomly distributed among remaining observations.
A list with the following entries:
(1) $index
A named character string with the code of the index, named with its name
(2) $local
A data.table, with three columns: J_Gi
, the local group dispersion
index; J_NGi
, the local non-group dispersion index; and J_i
, the local
total dispersion index. Rows are in the same order as the input vector. This data.table
also contains the chosen expectations and standards as hidden attributes to be used by
inferLID
.
(3) $global
A list with three entries: $J_G
, the global group dispersion index;
$J_NG
, the global nongroup dispersion index; and $J
, the global
total dispersion index.
(4) $canonical
The canonical Gini or Inoua index, if canonical = TRUE
and
index < 3
.
# Generate dummy observations
x <- runif(10, 1, 100)
# Get distance matrix
dists <- dist(x)
# Get fuzzy weights considering 5 nearest neighbors based on
# inverse square distance
weights <- makeWeights(dists, bw = 5,
mode = 'adaptive', weighting = 'distance',
FUN = function(x) 1/x^2, minval = 0.1,
row.stand = 'fuzzy')
# Obtain the 'local gini' value
lid <- LID(x, w = weights, index = 'gini', type = 'local')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.