inferLID | R Documentation |
Infer whether there exists more or less within- and between-group local and global inequality than would be expected versus if for all observations the values of all other observations were permuted. This tests if local values are significantly above or below what is expected given the global dataset, and if global values are significantly above or below what is expected given an otherwise random distribution.
inferLID(
lid,
w,
ntrials = 999,
alpha = 0.05,
standard = NULL,
expect = NULL,
multicore = FALSE,
ncores = parallel::detectCores() - 1,
var.stand = FALSE,
var.exp = FALSE,
ng.invert = TRUE,
max.cross = .Machine$integer.max,
pb = TRUE,
clear.mem = FALSE
)
lid |
The list output from the |
w |
The same spatial weights matrix used in calculating the |
ntrials |
The number of permutations to perform. Default is 999. |
alpha |
Threshold for significance. Default is |
standard |
The standards matrix with dimensions |
expect |
The expectations matrix with dimensions |
multicore |
Should multithreading be used? Default is |
ncores |
If |
var.stand |
Logical. Should the standards be permuted if a matrix was
provided? Default is |
var.exp |
Logical. Should the expectations be permuted if a matrix was
provided? Default is |
ng.invert |
Does a higher non-group value imply higher between group inequality?
Default is |
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 |
pb |
Logical. Should a progress bar be displayed? Default is |
clear.mem |
Logical. Should |
The output list can be passed to scatterLID
to plot
the group and non-group components of local inequality based on the significance
classes.
A list with the following entries:
(1) $local
A data.table with one column, indicating whether an observation is
falls in one of nine categories: Out-group High, Average, or Low for between-group
inequality, and In-group High, Average, or Low for within-group inequality based on
the significance according to the delta-J statistic in the $stats
data.table.
(2) $global
A list with four entries, $J_G
for the group component of the
global inequality, $J_NG
for the nongroup, $J
for the total,
and $Class, containing the significance class for the global dataset. Each
of the first three entries themselves contain three entriesL
$delta
, representing the delta-J statistic, $p
, representing its p-value,
and $Class, containing the group/non-group class
(3) $stats
A data.table containing the number of permutations a randomly-calculated
$J_Gi
, $J_NGi
, or $J_i
was above or below the real value
# 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')
# Infer whether values are significant relative to the spatial distribution
# of the neighbots
inference <- inferLID(lid, w = weights, ntrials = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.