scatterLID: Local Indicators of Dispersion Scatterplot

View source: R/scatterLID.R

scatterLIDR Documentation

Local Indicators of Dispersion Scatterplot

Description

Plot the local group and non-group components of a local indicator of dispersion, colored by their inference-based class.

Usage

scatterLID(
  lid = NULL,
  inference = NULL,
  log.scale = FALSE,
  key = TRUE,
  only.key = FALSE,
  arrows = FALSE,
  x.lim = NULL,
  y.lim = NULL
)

colorLID(x = NULL, table = FALSE, arrows = FALSE)

Arguments

lid

The list output of the LID function.

inference

The list output of the inferLID function.

log.scale

Logical. Should the axes be log-transformed? Default is FALSE. If TRUE, log transformation is log(1+x,10).

key

Logical. Should a color key be printed? Default is Key = TRUE. Set as FALSE if you wish to further manipulate the ggplot object

only.key

Logical. If only.key = TRUE, only a color key will be output and all other parameters will be ignored.

arrows

Logical. Should the points be displayed as arrows pointing to the appropriate quadrant according to the key? Default is arrows = FALSE. Ignored if table = TRUE in colorLID.

x.lim

One of NULL to determine the x-range automatically (the default), a numeric vector of length two providing the x boundaries, or a function that accepts the automatic boundaries and returns new limits (see scale_x_continuous).

y.lim

One of NULL to determine the y-range automatically (the default), a numeric vector of length two providing the y boundaries, or a function that accepts the automatic boundaries and returns new limits (see scale_y_continuous).

x

A character string or vector containing a LID significance class. Ignored if table = TRUE.

table

Logical. Should the function convert character strings of classes to hex codes of colors (table = FALSE, the default) or arrows (when arrows = TRUE) or should it return the conversion table itself?

Details

colorLID() acts as a function converting class names to the hex codes corresponding to the colors used by scatterLID when table = FALSE (the default), and returns the color table itself when table = FALSE.

Value

A ggplot object with two elements—the LID Scatter plot and its scale.

Examples


# 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, pb = FALSE)

# Plot the inferences
scatterLID(lid, inference)

andresgmejiar/lbmech documentation built on Feb. 2, 2025, 12:37 a.m.