inferLID.Rd
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,
var.stand = FALSE,
var.exp = FALSE,
ng.invert = TRUE,
max.cross = .Machine$integer.max,
pb = TRUE,
clear.mem = FALSE
)
The list output from the LID
function.
The same spatial weights matrix used in calculating the lid
input.
The number of permutations to perform. Default is 999.
Threshold for significance. Default is alpha = 0.05
.
The standards matrix with dimensions length(x) x length(x)
used
when calculating lid
. Ignored if none had been originally provided, otherwise
required.
The expectations matrix with dimensions length(x) x length(x)
used
when calculating lid
. Ignored if none had been originally provided, otherwise
required.
Logical. Should the standards be permuted if a matrix was
provided? Default is FALSE
.
Logical. Should the expectations be permuted if a matrix was
provided? Default is FALSE
.
Does a higher non-group value imply higher between group inequality?
Default is TRUE
. This is ignored if matrixes were not originally provided, as
it is automatically performed.
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 sqrt(.Machine$integer.max)
--usually
about 2^31 for most systems. Lower values result in a greater number of chunks
thus allowing larger data.sets to be calculated.
Logical. Should a progress bar be displayed? Default is FALSE
, although
if a large dataset is processed that requires adjusting max.cross
this can
be useful
Logical. Should gc
be run in the middle of the
calculation? Default is clear.mem
but set as TRUE
if memory limits are a concern.
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: Global High, Average, or Low for between-group
inequality, and Local High, Average, or Low for within-group inequality based on
the significance according to the delta-G statistic in the $stats
data.table.
(2) $global
A list with three entries, $G_G
for the group component of the
global inequality, $G_NG
for the nongroup, and $G
for the total. Each entry
itself contains two entries, $delta
, representing the delta-G statistic, and
$p
, representing its p-value.
(3) $stats
A data.table containing the number of permutations a randomly-calculated
$G_Gi
, $G_NGi
, or $G_i
was above or below the real value
The output list can be passed to scatterLID
to plot
the group and non-group components of local inequality based on the significance
classes.
# 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)
#>
|
| | 0%
|
|= | 1%
|
|= | 2%
|
|== | 3%
|
|=== | 4%
|
|=== | 5%
|
|==== | 6%
|
|===== | 7%
|
|====== | 8%
|
|====== | 9%
|
|======= | 10%
|
|======== | 11%
|
|======== | 12%
|
|========= | 13%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 19%
|
|============== | 20%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 23%
|
|================= | 24%
|
|================= | 25%
|
|================== | 26%
|
|=================== | 27%
|
|=================== | 28%
|
|==================== | 29%
|
|===================== | 30%
|
|===================== | 31%
|
|====================== | 32%
|
|======================= | 33%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 36%
|
|========================== | 37%
|
|========================== | 38%
|
|=========================== | 39%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 42%
|
|============================== | 43%
|
|============================== | 44%
|
|=============================== | 45%
|
|================================ | 46%
|
|================================= | 47%
|
|================================= | 48%
|
|================================== | 49%
|
|=================================== | 50%
|
|==================================== | 51%
|
|===================================== | 52%
|
|===================================== | 53%
|
|====================================== | 54%
|
|======================================= | 55%
|
|======================================== | 56%
|
|======================================== | 57%
|
|========================================= | 58%
|
|========================================== | 59%
|
|========================================== | 60%
|
|=========================================== | 61%
|
|============================================ | 62%
|
|============================================ | 63%
|
|============================================= | 64%
|
|============================================== | 65%
|
|============================================== | 66%
|
|=============================================== | 67%
|
|================================================ | 68%
|
|================================================= | 69%
|
|================================================= | 70%
|
|================================================== | 71%
|
|=================================================== | 72%
|
|=================================================== | 73%
|
|==================================================== | 74%
|
|===================================================== | 75%
|
|===================================================== | 76%
|
|====================================================== | 77%
|
|======================================================= | 78%
|
|======================================================= | 79%
|
|======================================================== | 80%
|
|========================================================= | 81%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|=========================================================== | 84%
|
|============================================================ | 85%
|
|============================================================ | 86%
|
|============================================================= | 87%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 90%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 93%
|
|================================================================== | 94%
|
|=================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 97%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 100%