Terraflux Terraflux
Download

Spatial statistics

7 operators. Inputs marked required must be connected or given; the others have defaults.

stats.getis_ord#

Getis and Ord's Gi* of every cell (PySAL's esda.G_Local with star and row-standardised weights, to rounding): the share of the map's total around the cell, itself included, its z and p, and the hot and cold spots at 90, 95 and 99% confidence (as ArcGIS's Gi_Bin: 1 to 3 hot, -1 to -3 cold).

InputTypeWhat it is
maprequiredmapthe values (positive)
OutputTypeWhat it is
gmapGi*
zmapits z
pmapits one-sided p (of |z|)
spotsmap3, 2, 1 hot spots at 99, 95, 90%; -1 to -3 cold; 0 none
SettingTypeWhat it is
contiguitytextthe neighbours: queen (default, 8) or rook (4)

stats.idw#

Inverse distance weighting of points onto a map, as R's gstat (idw, to rounding): every cell the mean of the points' values weighted by one over the distance to a power, with every point or the nearest; a point's value at its own place.

InputTypeWhat it is
pointsrequiredvectorthe points, their values in an attribute
likerequiredmapthe map whose cells to fill (those with a value)
OutputTypeWhat it is
mapmapthe values interpolated
SettingTypeWhat it is
fieldtextthe attribute of the values (default the only number)
powernumberthe distance's power (default 2)
nmaxintegerthe nearest points used (default all)

stats.kriging#

Ordinary kriging of points onto a map, as R's gstat (krige, to rounding): every cell the best linear unbiased prediction from the points' values under a variogram model (from stats.variogram, or given), with every point or the nearest, and the prediction's variance.

InputTypeWhat it is
pointsrequiredvectorthe points, their values in an attribute
likerequiredmapthe map whose cells to fill (those with a value)
modelanythe variogram model (stats.variogram's model)
OutputTypeWhat it is
predictionmapthe values predicted
variancemapthe prediction's variance
SettingTypeWhat it is
fieldtextthe attribute of the values (default the only number)
nmaxintegerthe nearest points used (default all)
shapetextwithout a model input: spherical, exponential or gaussian
psillnumberwithout a model input: the partial sill
rangenumberwithout a model input: the range
nuggetnumberwithout a model input: the nugget (default 0)

stats.lisa#

The local Moran's I of every cell (Anselin's LISA; PySAL's esda.Moran_Local, to rounding): how much it and its neighbours are alike, its quadrant (1 high among high, 2 low among high, 3 low among low, 4 high among low), its z under randomisation, a pseudo p of conditional permutations (its neighbours drawn among the other cells), and the clusters: the quadrant of the cells of p below alpha.

InputTypeWhat it is
maprequiredmapthe values
OutputTypeWhat it is
imapthe local Moran's I
quadrantmap1 high-high, 2 low-high, 3 low-low, 4 high-low
zmapits z under randomisation
pmapthe pseudo p of the permutations
clustersmapthe quadrant where p < alpha, 0 elsewhere
SettingTypeWhat it is
permutationsintegerper cell (default 99; 0 none)
alphanumberthe significance of the clusters (default 0.05)
seedintegerthe seed of the permutations (default 1)
contiguitytextthe neighbours: queen (default, 8) or rook (4)

stats.moran#

The global Moran's I of a map (PySAL's esda.Moran, to rounding): how much neighbouring cells are alike, over the contiguity of the cells with a value (row-standardised weights); its expectation, variance, z and two-sided p under normality and under randomisation, and a pseudo p of random permutations of the values.

InputTypeWhat it is
maprequiredmapthe values
OutputTypeWhat it is
tabletableI, EI, VI_norm, z_norm, p_norm, VI_rand, z_rand, p_rand, p_sim, n
SettingTypeWhat it is
permutationsintegerthe random permutations (default 999; 0 none)
seedintegerthe seed of the permutations (default 1)
contiguitytextthe neighbours: queen (default, 8) or rook (4)

stats.trend#

The monotonic trend of every cell along a series of maps (pymannkendall's original_test, the same numbers): the Mann-Kendall test (S, its variance corrected for ties, z, the two-sided p, Kendall's tau, increasing or decreasing at alpha) and Sen's slope (the median of the slopes between every pair of dates, per step of the series) with its intercept; the missing values of a cell left out.

InputTypeWhat it is
mapsrequiredrasterthe maps, a layer per date (a stack, a loop's series, rasters)
OutputTypeWhat it is
slopemapSen's slope, per step
interceptmapits intercept, at the first step
pmapthe Mann-Kendall test's two-sided p
zmapits z
taumapKendall's tau
trendmap1 increasing, -1 decreasing, 0 none (at alpha)
SettingTypeWhat it is
alphanumberthe significance level (default 0.05)

stats.variogram#

The sample variogram of points and a model fitted to it, as R's gstat (variogram and fit.variogram, to rounding): half the mean squared difference of the pairs of points in classes of distance up to a cutoff; a nugget and a spherical, exponential or Gaussian structure fitted by weighted least squares (the pairs over the squared distance as weights; a negative sill fixed at zero), for stats.kriging.

InputTypeWhat it is
pointsrequiredvectorthe points, their values in an attribute
OutputTypeWhat it is
tabletablea row per class with pairs: np, dist, gamma, model
modelanythe model fitted: {model, nugget, psill, range}
SettingTypeWhat it is
fieldtextthe attribute of the values (default the only number)
cutoffnumberthe largest distance (default a third of the diagonal)
widthnumberthe classes' width (default the cutoff / 15)
modeltextthe structure: spherical (default), exponential, gaussian, none
psillnumberthe partial sill to start from (default the variance)
rangenumberthe range to start from (default the cutoff / 3)
nuggetnumberthe nugget to start from (default the variance / 10)
fit_nuggetboolfit the nugget (default true), else keep it